/* ================================================================
   CSS RESET & BASE STYLES
   ================================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*::before,
*::after {
    box-sizing: border-box;
}

/* ================================================================
   CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ================================================================ */
:root {
    /* Color Palette */
    --primary: #1e40af;
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    --secondary: #0f172a;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Neutral Colors */
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Spacing & Dimensions */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-full: 50px;

    /* Shadows */
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 10px 10px -5px rgb(0 0 0 / 0.04);
    --shadow-xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);

    /* Typography */
    --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    --line-height-base: 1.6;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Z-Index Scale */
    --z-background: 0;
    --z-base: 1;
    --z-footer: 10;
    --z-modal: 100;
    --z-notification: 1000;
}

/* ================================================================
   BASE TYPOGRAPHY & LAYOUT
   ================================================================ */
body {
    font-family: var(--font-family-base);
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 35%, #334155 100%);
    min-height: 100vh;
    color: var(--gray-800);
    line-height: var(--line-height-base);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ================================================================
   LAYOUT COMPONENTS
   ================================================================ */
.bg-overlay {
    position: fixed;
    inset: 0;
    background: url('data:image/svg+xml,<svg width="80" height="80" viewBox="0 0 80 80" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="smallGrid" width="8" height="8" patternUnits="userSpaceOnUse"><path d="M 8 0 L 0 0 0 8" fill="none" stroke="%23334155" stroke-width="0.5" opacity="0.1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23smallGrid)"/></svg>') repeat;
    pointer-events: none;
    z-index: var(--z-background);
}

.container {
    /* min-height: 100vh; */
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: var(--z-base);
    padding: 2rem;
    gap: 2rem;
}


/* ================================================================
   NAVIGATION HEADER
   ================================================================ */
.nav-header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: var(--z-modal);
    border-bottom: 1px solid var(--gray-200);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem 1.5rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.nav-logo {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--white);
    font-size: 1rem;
}

.nav-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.nav-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
    line-height: 1.2;
}

.nav-subtitle {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin: 0;
    line-height: 1.2;
}

.nav-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-width: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary);
    color: var(--white);
}

.nav-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    min-width: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 0;
}

.user-info span {
    display: block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--danger);
    color: var(--white);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition-base);
}

.btn-logout:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* ================================================================
   NAVIGATION RESPONSIVE
   ================================================================ */
@media (max-width: 1200px) {
    .nav-container {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "brand actions"
            "menu menu";
        align-items: start;
    }

    .nav-brand {
        grid-area: brand;
    }

    .nav-actions {
        grid-area: actions;
    }

    .nav-menu {
        grid-area: menu;
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.25rem;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .nav-menu::-webkit-scrollbar {
        height: 6px;
    }

    .nav-menu::-webkit-scrollbar-thumb {
        background: var(--gray-300);
        border-radius: var(--radius-full);
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0.85rem 1rem;
        gap: 0.75rem;
    }

    .nav-title {
        font-size: 1.1rem;
    }

    .nav-subtitle {
        font-size: 0.7rem;
    }

    .nav-link {
        padding: 0.45rem 0.7rem;
        font-size: 0.8125rem;
    }

    .user-info {
        gap: 0.4rem;
        font-size: 0.8125rem;
    }

    .user-info span {
        max-width: 120px;
    }
}

@media (max-width: 560px) {
    .nav-container {
        grid-template-columns: 1fr;
        grid-template-areas:
            "brand"
            "actions"
            "menu";
    }

    .nav-actions {
        width: 100%;
        justify-content: space-between;
    }

    .user-info {
        flex: 1;
    }

    .user-info span {
        max-width: 100%;
    }

    .nav-menu {
        margin-top: 0;
    }
}

.divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  gap: 12px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-800);
}

.divider span {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}

/* ================================================================
   MAIN CONTENT LAYOUT
   ================================================================ */
.main-content {
    flex: 1;
    padding: 2rem;
    min-height: calc(100vh - 200px);
}

.content-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ================================================================
   PAGE HEADER
   ================================================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--white);
    margin: 0 0 0.5rem 0;
}

.page-subtitle {
    font-size: 1rem;
    color: var(--gray-300);
    margin: 0;
}

.page-actions-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.page-actions .btn-primary,
.page-actions-group .btn-primary,
.page-actions-group .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--transition-base);
    box-shadow: var(--shadow);
    border: 2px solid;
    cursor: pointer;
}

.page-actions .btn-primary,
.page-actions-group .btn-primary {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.page-actions .btn-primary:hover,
.page-actions-group .btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.page-actions-group .btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.page-actions-group .btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

/* ================================================================
   MESSAGES
   ================================================================ */
.messages-container {
    margin-bottom: 2rem;
}

.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    border: 1px solid;
    position: relative;
    animation: slideInDown 5s ease;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.alert-info {
    background: #f0f9ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

.alert-close {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-base);
}

.alert-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* ================================================================
   SHARED TOAST NOTIFICATIONS
   ================================================================ */
.tm-message-center {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: min(420px, calc(100vw - 2rem));
    z-index: var(--z-notification, 1000);
    pointer-events: none;
}

.tm-toast {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 0.625rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--white);
    color: var(--gray-800);
    box-shadow: var(--shadow-lg);
    padding: 0.875rem 0.95rem;
    opacity: 0;
    transform: translateX(18px);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    pointer-events: auto;
}

.tm-toast--show {
    opacity: 1;
    transform: translateX(0);
}

.tm-toast--hide {
    opacity: 0;
    transform: translateX(18px);
}

.tm-toast__icon {
    margin-top: 0.1rem;
    font-size: 1rem;
}

.tm-toast__content {
    font-size: 0.875rem;
    line-height: 1.35;
    word-break: break-word;
}

.tm-toast__close {
    border: none;
    background: transparent;
    color: currentColor;
    opacity: 0.75;
    cursor: pointer;
    border-radius: 6px;
    width: 1.5rem;
    height: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), opacity var(--transition-fast);
}

.tm-toast__close:hover,
.tm-toast__close:focus-visible {
    opacity: 1;
    background: rgba(15, 23, 42, 0.08);
}

.tm-toast--success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.tm-toast--error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.tm-toast--warning {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}

.tm-toast--info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

/* ================================================================
   FOOTER
   ================================================================ */
.footer {
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    box-shadow: 0 -1px 3px 0 rgb(0 0 0 / 0.1);
    margin-top: auto;
    position: relative;
    z-index: var(--z-footer);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.footer-links a {
    color: var(--gray-600);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-base);
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-copyright {
    color: var(--gray-500);
    font-size: 0.875rem;
    text-align: right;
}

/* ================================================================
   FOOTER RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        padding: 1.5rem;
    }

    .footer-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .footer-copyright {
        text-align: center;
        width: 100%;
    }

    .tm-message-center {
        top: 0.75rem;
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
    }
}

@media (max-width: 480px) {
    .footer-content {
        padding: 1rem;
        gap: 1rem;
    }

    .footer-links {
        gap: 1rem;
    }

    .footer-links a {
        font-size: 0.8rem;
    }

    .footer-copyright {
        font-size: 0.8rem;
    }
}

/* ================================================================
   ANIMATIONS
   ================================================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

