:root {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #fafbfc;
    --bg-input: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #e8ecf1;
    --border-color-dark: #dfe4ea;
    --shadow: rgba(0, 0, 0, 0.08);
    --shadow-hover: rgba(0, 0, 0, 0.15);
}

/* Dark mode - applied to html element for instant loading (no flash) */
html.dark-mode,
body.dark-mode {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --bg-input: #3a3a3a;
    --text-primary: #e4e4e4;
    --text-secondary: #a0a0a0;
    --border-color: #4a4a4a;
    --border-color-dark: #5a5a5a;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.5);
}

.header {
    background: var(--bg-secondary);
    box-shadow: 0 2px 8px var(--shadow);
    padding: 14px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-img {
    height: 43px;
    width: auto;
}

.logo-text {
    font-size: 1.68em;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.header-tagline {
    color: var(--text-secondary);
    font-size: 0.85em;
    margin-left: 15px;
    padding-left: 15px;
    border-left: 2px solid var(--border-color);
}

.burger-menu {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 1001;
}

.burger-menu span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--text-primary);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.burger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.burger-menu.active span:nth-child(2) {
    opacity: 0;
}

.burger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Menu backdrop overlay */
.menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu-backdrop.active {
    display: block;
    opacity: 1;
}

.menu-dropdown {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 33.33vw;
    max-width: 400px;
    min-width: 280px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    padding: 80px 0 20px;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}

body.dark-mode .menu-dropdown {
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
}

.menu-dropdown.active {
    transform: translateX(0);
}

/* Desktop: show as dropdown instead of slide-in */
@media (min-width: 769px) {
    .menu-dropdown {
        position: absolute;
        top: 100%;
        right: 20px;
        height: auto;
        width: 280px;
        max-width: none;
        border-left: none;
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 12px;
        margin-top: 10px;
        transform: translateY(-10px);
        opacity: 0;
        transition: transform 0.2s ease, opacity 0.2s ease;
    }

    .menu-dropdown.active {
        transform: translateY(0);
        opacity: 1;
    }

    .menu-backdrop {
        display: none !important;
    }
}

.menu-item {
    padding: 0;
    margin: 0;
    border-radius: 0;
    transition: background 0.2s ease;
}

.menu-item:hover {
    background: var(--bg-tertiary);
}

.menu-item:last-child {
    margin-bottom: 0;
}

/* Menu section headers for better organization */
.menu-section {
    padding: 12px 20px 8px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
    display: none;
}

.menu-dropdown.active .menu-section {
    display: block;
}

.dark-mode-btn {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.12em;
    transition: all 0.3s ease;
    color: var(--text-primary);
    padding: 0;
    line-height: 1;
}

.dark-mode-btn:hover {
    border-color: #667eea;
    background: var(--bg-tertiary);
    transform: scale(1.05);
}

.dark-mode-btn:active {
    transform: scale(0.95);
}

.menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
    border: none;
}

#user-menu {
    display: block;
    width: 100%;
    padding-left: 20px;
}

/* Button styles for header */
.btn {
    padding: 13px 28px;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
}

.btn-primary {
    background: #10b981;
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.btn-primary:hover {
    background: #059669;
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

#user-menu .btn {
    width: auto;
    margin: 0 !important;
}

.user-avatar-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    color: var(--text-primary);
    width: 100%;
}

.user-avatar-btn:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.user-avatar-btn img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.user-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-content {
    position: relative;
    right: 0;
    top: 0;
    background: var(--bg-secondary);
    min-width: 100%;
    box-shadow: 0 2px 8px var(--shadow);
    border-radius: 8px;
    z-index: 1000;
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-top: 10px;
}

.dropdown-content a {
    display: block;
    padding: 12px 20px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-content a:hover {
    background: var(--bg-tertiary);
}

.dropdown-content a:last-child {
    border-bottom: none;
}

/* Menu links (unified style for all menu items) */
.menu-link {
    display: flex;
    align-items: center;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1em;
    padding: 14px 20px;
    transition: all 0.2s ease;
    border-radius: 0;
    width: 100%;
    gap: 12px;
}

.menu-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.menu-link:focus {
    outline: 2px solid #2d6a4f;
    outline-offset: -2px;
}

body.dark-mode .menu-link:focus {
    outline-color: #40916c;
}

/* Menu button (for My Projects, etc.) - deprecated, use menu-link instead */
.menu-btn {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    width: 100%;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.menu-btn:hover {
    border-color: #2d6a4f;
    background: var(--bg-tertiary);
}

/* Projects Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.3em;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.8em;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0 5px;
    line-height: 1;
}

.close-modal:hover {
    color: var(--text-primary);
}

#projectsListContainer {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

#projectsList {
    list-style: none;
    padding: 0;
    margin: 0;
}

.project-item {
    padding: 15px;
    background: var(--bg-tertiary);
    margin-bottom: 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    cursor: pointer;
}

.project-item:hover {
    background: var(--bg-input);
    border-color: #2d6a4f;
    transform: translateX(5px);
}

.project-info {
    flex: 1;
}

.project-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.05em;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tool-badge {
    font-size: 0.7em;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tool-badge.current {
    background: #2d6a4f;
    color: white;
    border-color: #2d6a4f;
}

.project-date {
    font-size: 0.85em;
    color: var(--text-secondary);
}

.project-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
}

.btn-icon.delete:hover {
    background: rgba(231, 76, 60, 0.2);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-hint {
    font-size: 0.9em;
    margin-top: 10px;
}

@media (max-width: 768px) {
    .header-tagline {
        display: none;
    }

    .logo-img {
        height: 34px;
    }

    .logo-text {
        font-size: 1.14em;
    }
    
    .dark-mode-btn {
        width: 32px;
        height: 32px;
        font-size: 0.96em;
    }
    
    .header-actions {
        gap: 8px;
    }
    
    .project-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .project-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* Ensure menu takes full height on mobile */
    .menu-dropdown {
        padding-top: 70px;
    }
}

/* Cookie Consent Banner */
.cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 2px solid var(--border-color);
    box-shadow: 0 -4px 16px var(--shadow);
    z-index: 10000;
    padding: 20px;
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

body.dark-mode .cookie-consent-banner {
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.5);
}

.cookie-consent-content {
    max-width: 1200px;
    margin: 0 auto;
}

.cookie-consent-step {
    width: 100%;
}

.cookie-consent-text {
    margin-bottom: 20px;
}

.cookie-consent-text strong {
    display: block;
    color: var(--text-primary);
    font-size: 1.2em;
    margin-bottom: 8px;
}

.cookie-consent-text p {
    color: var(--text-secondary);
    font-size: 0.95em;
    line-height: 1.6;
    margin: 0;
}

.cookie-consent-text a {
    color: #10b981;
    text-decoration: none;
}

.cookie-consent-text a:hover {
    text-decoration: underline;
}

body.dark-mode .cookie-consent-text a {
    color: #40916c;
}

.cookie-consent-options {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cookie-option {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.cookie-option-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    margin: 0;
}

.cookie-checkbox {
    margin-top: 2px;
    width: 18px;
    height: 18px;
    min-width: 18px;
    cursor: pointer;
    accent-color: #10b981;
}

body.dark-mode .cookie-checkbox {
    accent-color: #40916c;
}

.cookie-checkbox:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cookie-option-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cookie-option-text strong {
    color: var(--text-primary);
    font-size: 1em;
    font-weight: 600;
}

.cookie-option-desc {
    color: var(--text-secondary);
    font-size: 0.85em;
    line-height: 1.4;
}

.cookie-consent-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.cookie-btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.cookie-btn-decline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.cookie-btn-decline:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-color-dark);
}

.cookie-btn-primary {
    background: #10b981;
    color: white;
    border: none;
    font-size: 1.05em;
    padding: 12px 24px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.cookie-btn-primary:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

body.dark-mode .cookie-btn-primary {
    background: #40916c;
    box-shadow: 0 2px 8px rgba(64, 145, 108, 0.3);
}

body.dark-mode .cookie-btn-primary:hover {
    background: #2d6a4f;
    box-shadow: 0 4px 12px rgba(64, 145, 108, 0.4);
}

.cookie-btn-save {
    background: #10b981;
    color: white;
    border: none;
}

.cookie-btn-save:hover {
    background: #059669;
}

body.dark-mode .cookie-btn-save {
    background: #40916c;
}

body.dark-mode .cookie-btn-save:hover {
    background: #2d6a4f;
}

.cookie-btn-accept {
    background: #10b981;
    color: white;
    border: none;
}

.cookie-btn-accept:hover {
    background: #059669;
}

body.dark-mode .cookie-btn-accept {
    background: #40916c;
}

body.dark-mode .cookie-btn-accept:hover {
    background: #2d6a4f;
}

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

.cookie-btn-customize:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-color-dark);
}

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

.cookie-btn-back:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-color-dark);
}

@media (max-width: 768px) {
    .cookie-consent-banner {
        padding: 15px;
    }
    
    .cookie-consent-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .cookie-btn {
        width: 100%;
    }
    
    .cookie-btn-primary {
        order: -1; /* Primary button appears first on mobile */
    }
}

