:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --dark: #0f172a;
    --light: #f8fafc;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Normalized spacing and sizing */
    --navbar-height: 100px; /* Increased for larger logo */
    --content-max-width: 1400px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    background: var(--light);
    color: var(--dark);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container width control */
.container {
    max-width: var(--content-max-width);
}

/* Enhanced Navigation - Fixed sizing */
.navbar {
    height: var(--navbar-height);
    padding: 0;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar .container {
    height: 100%;
    display: flex;
    align-items: center;
}

.navbar.scrolled {
    height: 70px; /* Slightly reduced when scrolled */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Larger Logo Styles */
.navbar-brand {
    font-weight: 800;
    font-size: 1.25rem;
    background: var(--gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    padding: 0;
    margin: 0;
}

.navbar-brand img {
    height: 90px; /* Increased from 60px to 70px */
    width: auto;
    transition: all 0.3s ease;
    object-fit: contain;
}

.navbar.scrolled .navbar-brand img {
    height: 80px; /* Slightly smaller when scrolled */
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.navbar-brand:hover img {
    transform: scale(1.05);
}

.nav-link {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--dark) !important;
    padding: 0.5rem 0.875rem !important;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    position: relative;
    white-space: nowrap;
}

.nav-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--gradient-2);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::before,
.nav-link.active::before {
    width: 80%;
}

.nav-link:hover {
    color: var(--primary) !important;
    background: rgba(37, 99, 235, 0.05);
}

.nav-link i {
    font-size: 0.9rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-2);
    color: white;
    font-size: 1rem;
}

.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: 0.75rem;
    padding: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.dropdown-item {
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.dropdown-item i {
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    transform: translateX(5px);
}

.dropdown-header {
    font-size: 0.875rem;
    padding: 0.5rem 0.875rem;
}

/* Language Switcher - Optimized sizing */
.language-switcher {
    display: flex;
    gap: 0.375rem;
    align-items: center;
}

.lang-btn {
    padding: 0.375rem 0.75rem;
    border: 2px solid transparent;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--dark);
    font-weight: 600;
    font-size: 0.813rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    line-height: 1;
}

.lang-btn:hover {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    border-color: var(--primary);
}

.lang-btn.active {
    background: var(--gradient-2);
    color: white;
    border-color: transparent;
}

/* Messages - Responsive positioning */
.messages-container {
    position: fixed;
    top: calc(var(--navbar-height) + 15px);
    right: 20px;
    z-index: 9999;
    max-width: 380px;
    width: calc(100% - 40px);
}

.alert {
    border: none;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.alert-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
    border-left: 4px solid var(--success);
    color: #065f46;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.1) 100%);
    border-left: 4px solid var(--danger);
    color: #991b1b;
}

.alert-info {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1) 0%, rgba(14, 165, 233, 0.1) 100%);
    border-left: 4px solid var(--info);
    color: #0c4a6e;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(217, 119, 6, 0.1) 100%);
    border-left: 4px solid var(--warning);
    color: #78350f;
}

.alert i {
    font-size: 1rem;
}

/* Main Content - Normalized spacing */
main {
    min-height: calc(100vh - var(--navbar-height) - 80px);
    padding-top: var(--navbar-height);
}

/* Enhanced Footer - Optimized sizing */
footer {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
    position: relative;
    overflow: hidden;
    padding: 3rem 0 1.5rem;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

footer h6 {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 1.25rem;
    position: relative;
    display: inline-block;
}

footer h6::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 35px;
    height: 3px;
    background: var(--gradient-2);
    border-radius: 2px;
}

footer a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
    font-size: 0.9rem;
}

footer a:hover {
    color: white;
    transform: translateX(5px);
}

footer p {
    font-size: 0.9rem;
}

footer .social-links a {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    font-size: 1rem;
}

footer .social-links a:hover {
    background: var(--gradient-2);
    transform: translateY(-5px);
}

footer ul {
    padding-left: 0;
}

footer li {
    margin-bottom: 0.625rem;
}

/* Enhanced Buttons - Normalized sizing */
.btn {
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.625rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    position: relative;
    overflow: hidden;
    line-height: 1.5;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-2);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
}

.btn-outline-primary {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* Responsive Design - Laptop optimizations */
@media (min-width: 1200px) and (max-width: 1600px) {
    html {
        font-size: 15px;
    }

    :root {
        --content-max-width: 1200px;
    }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    html {
        font-size: 14px;
    }

    :root {
        --content-max-width: 1000px;
    }

    .navbar-brand img {
        height: 65px;
    }

    .navbar.scrolled .navbar-brand img {
        height: 50px;
    }

    .nav-link {
        padding: 0.5rem 0.75rem !important;
    }
}

/* Tablet */
@media (max-width: 991.98px) {
    .navbar {
        height: 75px;
    }

    .navbar.scrolled {
        height: 65px;
    }

    .navbar-brand img {
        height: 80px;
    }

    .navbar.scrolled .navbar-brand img {
        height: 70px;
    }

    .navbar-collapse {
        background: white;
        padding: 1.25rem;
        border-radius: 0.75rem;
        margin-top: 1rem;
        box-shadow: var(--shadow-lg);
    }

    .nav-link::before {
        display: none;
    }

    .messages-container {
        top: calc(75px + 10px);
        right: 15px;
        left: 15px;
        max-width: none;
        width: auto;
    }

    .language-switcher {
        margin-top: 1rem;
        justify-content: center;
    }

    main {
        padding-top: 75px;
    }
}

/* Mobile */
@media (max-width: 767.98px) {
    html {
        font-size: 14px;
    }

    .navbar {
        height: 70px;
    }

    .navbar.scrolled {
        height: 60px;
    }

    .navbar-brand img {
        height: 80px;
    }

    .navbar.scrolled .navbar-brand img {
        height: 60px;
    }

    main {
        padding-top: 70px;
    }

    footer {
        padding: 2.5rem 0 1.25rem;
    }

    footer h6 {
        font-size: 0.938rem;
    }

    .messages-container {
        top: calc(70px + 10px);
        right: 10px;
        left: 10px;
    }

    .alert {
        padding: 0.875rem 1rem;
    }
}

@media (max-width: 575.98px) {
    html {
        font-size: 13px;
    }

    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .navbar-brand img {
        height: 80px;
    }

    .navbar.scrolled .navbar-brand img {
        height: 70px;
    }
}

/* Loading Animation */
.btn.loading {
    pointer-events: none;
    position: relative;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    margin-left: -9px;
    margin-top: -9px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spinner 0.8s linear infinite;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light);
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-2);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Print styles */
@media print {
    .navbar,
    footer,
    .messages-container {
        display: none !important;
    }

    main {
        padding-top: 0 !important;
    }
}

.htmx-indicator {
    opacity: 0;
    transition: opacity 0.2s ease;
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
}

.htmx-request .htmx-indicator {
    opacity: 1;
}
