/* ============================================
   AGENCY OS - ENTERPRISE UI SHELL V1.0
   Zentrales Layout-System für konsistente Seiten
   Dark Mode Default
   ============================================ */

/* ============================================
   APP SHELL - Grundgerüst
   ============================================ */

.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--bg-body);
}

/* ============================================
   APP MAIN - Hauptbereich rechts der Sidebar
   ============================================ */

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width, 260px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

@media (max-width: 767px) {
    .app-main {
        margin-left: 0;
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    }
}

/* ============================================
   APP HEADER - Fixierte Top-Bar
   ============================================ */

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 80px;
    min-height: 80px;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
}

.app-header__title-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-header__title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.app-header__subtitle {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin: 0;
    margin-top: 0.25rem;
}

.app-header__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Header Action Buttons */
.app-header__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--glass-bg, rgba(255, 255, 255, 0.15));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.2));
    border-radius: var(--radius-lg, 0.75rem);
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.app-header__btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.app-header__btn--primary {
    background: var(--gradient-cta, linear-gradient(135deg, #F59E0B 0%, #D97706 100%));
    border-color: transparent;
}

.app-header__btn--primary:hover {
    background: var(--gradient-cta-hover, linear-gradient(135deg, #D97706 0%, #B45309 100%));
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Mobile Header */
@media (max-width: 767px) {
    .app-header {
        height: 64px;
        min-height: 64px;
        padding: 0 1rem;
    }
    
    .app-header__title {
        font-size: 1.25rem;
    }
    
    .app-header__subtitle {
        display: none;
    }
    
    .app-header__btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }
    
    .app-header__btn span:not(.app-header__btn-icon) {
        display: none;
    }
    
    .app-header__btn-icon {
        font-size: 1.125rem;
    }
}

/* ============================================
   CONTENT CONTAINER - Inhalt-Wrapper
   ============================================ */

.content-container {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem 2rem;
}

/* Fluid Modifier - Volle Breite für Tabellen etc. */
.content-container--fluid {
    max-width: none;
    padding: 0 1.5rem 2rem;
}

@media (max-width: 767px) {
    .content-container {
        padding: 0 1rem 1.5rem;
    }
    
    .content-container--fluid {
        padding: 0 0.75rem 1.5rem;
    }
}

/* ============================================
   CONTENT CARDS - Standard-Karten
   ============================================ */

.content-card {
    background: white;
    border-radius: var(--radius-xl, 1rem);
    box-shadow: var(--shadow-lg, 0 10px 30px rgba(0, 0, 0, 0.12));
    overflow: hidden;
}

.content-card__header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--neutral-200, #e2e8f0);
}

.content-card__title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--neutral-800, #1e293b);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.content-card__body {
    padding: 2rem;
}

@media (max-width: 767px) {
    .content-card__header {
        padding: 1rem 1.25rem;
    }
    
    .content-card__body {
        padding: 1.25rem;
    }
}

/* ============================================
   SECTION SPACING - Abstände zwischen Sektionen
   ============================================ */

.section {
    margin-bottom: 1.5rem;
}

.section:last-child {
    margin-bottom: 0;
}

.section__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--neutral-700, #374151);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--neutral-200, #e2e8f0);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ============================================
   STATS GRID - Statistik-Karten
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg, 0.75rem);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md, 0 4px 6px rgba(0, 0, 0, 0.1));
}

.stat-card__value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-600, #0D9488);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-card__label {
    font-size: 0.875rem;
    color: var(--neutral-500, #64748b);
    font-weight: 500;
}

@media (max-width: 767px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card__value {
        font-size: 1.5rem;
    }
    
    .stat-card__label {
        font-size: 0.75rem;
    }
}

/* ============================================
   EMPTY STATE - Leere Zustände
   ============================================ */

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--neutral-500, #64748b);
}

.empty-state__icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.empty-state__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--neutral-700, #374151);
    margin-bottom: 0.5rem;
}

.empty-state__text {
    font-size: 0.9375rem;
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   PAGE-SPECIFIC BODY STYLES
   ============================================ */

body.has-app-shell {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   ADMIN LAYOUT - Ohne Sidebar
   ============================================ */

body.admin-layout {
    background: linear-gradient(135deg, var(--admin-primary, #e74c3c) 0%, var(--admin-secondary, #c0392b) 100%);
}

.admin-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Admin Main - Kein Sidebar-Margin */
.admin-main {
    flex: 1;
    margin-left: 0;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem 2rem;
}

@media (max-width: 767px) {
    .admin-main {
        padding: 0 1rem 1.5rem;
    }
}

/* Admin Header */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.admin-header__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-header__logo {
    font-size: 1.5rem;
}

.admin-header__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.admin-header__badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    letter-spacing: 0.05em;
}

.admin-header__actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Admin Navigation */
.admin-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.admin-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.admin-nav__link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.admin-nav__link--active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
}

/* Admin User Info */
.admin-header__user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-user-info {
    display: flex;
    align-items: center;
}

.admin-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.admin-user-avatar--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Admin Header Buttons */
.admin-header__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    color: white;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-header__btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.admin-header__btn--logout {
    background: rgba(255, 255, 255, 0.9);
    color: var(--admin-primary, #e74c3c);
    border-color: transparent;
}

.admin-header__btn--logout:hover {
    background: white;
}

/* Admin Warning Banner */
.admin-warning-banner {
    background: rgba(255, 255, 255, 0.95);
    color: var(--admin-dark, #1e293b);
    padding: 0.75rem 1.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 2px solid var(--admin-primary, #e74c3c);
}

/* Admin Page Header - LINKSBÜNDIG */
.admin-page-header {
    padding: 1.5rem 0 1rem;
    text-align: left;
}

.admin-page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    margin: 0 0 0.25rem;
    line-height: 1.2;
}

.admin-page-subtitle {
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
}

/* Admin Content Container Override */
.admin-shell .content-container {
    max-width: none;
}

.admin-shell .content-container--boxed {
    max-width: 1200px;
}

/* Admin Cards */
.admin-card {
    background: white;
    border-radius: var(--radius-lg, 0.75rem);
    box-shadow: var(--shadow-md, 0 4px 6px rgba(0, 0, 0, 0.1));
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.admin-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--neutral-200, #e5e7eb);
}

.admin-card__title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--neutral-800, #1e293b);
    margin: 0;
}

/* Admin Tables */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.admin-table th,
.admin-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--neutral-200, #e5e7eb);
}

.admin-table th {
    background: var(--neutral-50, #f8fafc);
    font-weight: 600;
    color: var(--neutral-600, #475569);
    white-space: nowrap;
}

.admin-table tr:hover td {
    background: var(--neutral-50, #f8fafc);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid #3b82f6;
    animation: toastFadeIn 0.3s ease-out;
}

.toast-success { border-left-color: #10b981; }
.toast-error { border-left-color: #ef4444; }
.toast-warning { border-left-color: #f59e0b; }

.toast-icon { font-size: 24px; flex-shrink: 0; }
.toast-message { flex: 1; font-size: 14px; color: #1e293b; font-weight: 500; }

.toast-close {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.toast-close:hover { background: #f1f5f9; color: #475569; }

@keyframes toastFadeIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

.toast-exit { animation: toastFadeOut 0.3s ease-out forwards; }

@keyframes toastFadeOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

/* Admin Mobile Responsive */
@media (max-width: 1024px) {
    .admin-nav {
        display: none;
    }
}

@media (max-width: 767px) {
    .admin-header {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 1rem;
    }
    
    .admin-header__brand {
        order: 1;
    }
    
    .admin-header__user {
        order: 2;
        margin-left: auto;
    }
    
    .admin-header__title {
        font-size: 1rem;
    }
    
    .admin-header__btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .admin-user-info {
        display: none;
    }
    
    .admin-page-title {
        font-size: 1.5rem;
    }
    
    .admin-card {
        padding: 1rem;
        border-radius: 0.5rem;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8125rem;
    }
    
    .toast-container {
        bottom: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
    }
}
