@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');

/* Base Styles for Beaver App - Common global styles */

:root {
    --cafe-noir: #4B3621;
    --verdigris: #43B3AE;
    --asparagus: #87A96B;
    --buff: #F0DC82;
    --light-blue: #ADD8E6;
    --bg: #ffffff;
    --muted: #6B5B4A;
    --card-shadow: 0 6px 20px rgba(75, 54, 33, 0.08);
    --glass: rgba(10, 10, 10, 0.02);
    --radius-md: 10px;
    --thread-background: #9fcccc80;
    --beaver-green: #4CAF50;
    --beaver-dark-green: #2E7D32;
    --text-color: #333333;
    --light-text-color: #666666;
    --border-color: #dddddd;
    --light-background: #f9f9f9;
    --white: #ffffff;

    /* Semantic Aliases (from Landing Page) */
    --text-primary: var(--cafe-noir);
    --text-secondary: var(--muted);
    --accent-primary: var(--verdigris);
    --accent-secondary: var(--beaver-dark-green);
    --accent-soft: var(--buff);

    /* Landing Page Specifics */
    --bg-warm: #FAF9F6;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --card-shadow-landing: 0 20px 40px rgba(75, 54, 33, 0.12);
}

/* Global Reset & Base */
body {
    font-family: 'Inter', Arial, Helvetica, sans-serif;
    color: var(--text-color);
    background-color: var(--white);
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 20px;
    -webkit-font-smoothing: antialiased;
}

/* Mobile Standardization */
@media (max-width: 768px) {

    html,
    body {
        height: 100dvh !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        position: fixed;
        width: 100%;
    }

    body {
        max-width: none !important;
    }
}

/* Premium Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* Branded Text Selection */
::selection {
    background: rgba(67, 179, 174, 0.25);
    /* Verdigris with transparency */
    color: inherit;
}

a {
    color: var(--beaver-green);
    text-decoration: none;
}

a:hover {
    color: var(--verdigris);
}

/* Typography */
h1 {
    color: var(--cafe-noir);
    margin-top: 1em;
    margin-bottom: 0.5em;
}

h2,
h3,
h4,
h5,
h6 {
    color: var(--text-color);
    margin-top: 1em;
    margin-bottom: 0.5em;
}

p {
    margin-bottom: 1em;
}

/* Page Container global utility */
/* Page Container global utility */
.page-container {
    max-width: 1260px;
    margin: 40px auto 120px;
    padding: 24px 30px;
    width: 100%;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    min-height: 80vh;
}

.page-container.wide {
    max-width: 1400px;
}

.page-container.narrow {
    max-width: 600px;
}

@media (max-width: 768px) {
    .page-container {
        padding: 16px;
        margin: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        min-height: 100vh;
    }
}

/* Header & Navigation */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 1001;
    background-color: var(--white);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-link {
    text-decoration: none;
}

.logo-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.logo-text {
    font-family: 'Outfit', 'Arial Black', Gadget, sans-serif;
    font-weight: 800;
    font-size: 28px;
    color: var(--cafe-noir);
    letter-spacing: -0.02em;
}


.header-right-items {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Desktop Navigation */
nav.desktop-nav {
    display: flex;
    align-items: center;
    margin-left: 40px;
}

nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    height: 100%;
}

nav ul li {
    margin-left: 20px;
    display: flex;
    align-items: center;
}

nav a {
    color: var(--text-color);
    font-weight: bold;
}

nav a:hover {
    color: var(--verdigris);
}

.refer-link {
    color: var(--verdigris);
    text-decoration: none;
    font-weight: 500;
    border: 1px solid var(--verdigris);
    padding: 6px 12px;
    border-radius: 4px;
    margin-left: 15px;
}

/* User Controls & Dropdown */
.user-controls,
.signin-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-menu-container {
    position: relative;
    cursor: pointer;
    outline: none;
}

.user-initials-trigger {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px;
    border-radius: 20px;
    transition: background-color 0.2s;
}

.user-initials-trigger:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.dropdown-caret {
    color: var(--text-secondary);
    font-size: 20px;
}

.user-dropdown {
    position: absolute;
    top: 120%;
    right: 0;
    width: 220px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    display: none;
    /* Hidden by default */
    flex-direction: column;
    z-index: 2000;
    overflow: hidden;
    padding: 8px 0;
    animation: fadeIn 0.1s ease-out;
}

/* Show dropdown on hover or focus */
.user-menu-container:hover .user-dropdown,
.user-menu-container:focus .user-dropdown,
.user-menu-container:focus-within .user-dropdown {
    display: flex;
}

.dropdown-header {
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
}

.dropdown-email {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.dropdown-item {
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-color);
    font-size: 14px;
    text-decoration: none;
    transition: background 0.2s;
    background: none;
    border: none;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    text-align: left;
}

.dropdown-item:hover {
    background: #f5f7fa;
    color: var(--verdigris);
}

.dropdown-item.danger:hover {
    background: #fff5f5;
    color: #d32f2f;
}

.dropdown-item .material-icons {
    font-size: 18px;
    color: inherit;
    opacity: 0.7;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logout-form-dropdown {
    margin: 0;
    padding: 0;
    width: 100%;
}

.user-initials {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--verdigris);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    transition: background-color 0.3s;
}

.user-initials:hover {
    background-color: #379c98;
}

.mobile-only-avatar {
    display: none;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: var(--verdigris);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

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

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Mobile Navigation Drawer */
.mobile-nav {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    background-color: var(--white);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.mobile-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-profile {
    padding: 20px 20px;
    background-color: var(--light-background);
    border-bottom: 1px solid var(--border-color);
}

.mobile-account-link {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mobile-nav ul li {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.mobile-nav a {
    color: var(--text-color);
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-nav .material-icons {
    font-size: 20px;
    color: var(--text-secondary);
}

.mobile-nav a:hover .material-icons {
    color: var(--verdigris);
}

.mobile-logout-button {
    background: none;
    border: none;
    color: #d32f2f;
    /* Red danger color */
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    text-align: left;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    /* Space between icon and text matching other items */
}

.mobile-logout-button .material-icons {
    font-size: 20px;
    /* Match standard icon size */
}

.mobile-logout-button:hover {
    color: var(--verdigris);
}

@media (max-width: 768px) {

    /* Show hamburger menu on mobile */
    .menu-toggle {
        display: flex;
        z-index: 1002;
        /* Ensure above dropdowns */
    }

    /* Hide desktop specific elements */
    .desktop-nav,
    .user-controls {
        display: none !important;
    }

    /* Ensure layout spacing */
    .header-right-items {
        gap: 15px;
    }

    .mobile-nav {
        display: block;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-in-out;
    }

    .mobile-nav.active {
        max-height: 85vh;
        /* Allow menu to grow large enough for all items */
        overflow-y: auto;
        /* Scroll if still too tall */
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
}


/* Buttons */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    align-self: center;
    font-family: 'Outfit', sans-serif;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.button:hover {
    color: var(--verdigris);
    border-color: var(--verdigris);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    /* Pressed in effect */
}

.button.primary {
    background-color: var(--verdigris);
    border-color: var(--verdigris);
    color: var(--white);
}

.button.primary:hover {
    background-color: #379c98;
    border-color: #379c98;
}

.button.danger {
    background-color: #d32f2f;
    border-color: #d32f2f;
    color: var(--white);
}

.button.danger:hover {
    background-color: #b71c1c;
    border-color: #b71c1c;
}

.button:disabled,
.button.disabled {
    background-color: #f5f5f5 !important;
    border-color: #ccc !important;
    color: #999 !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

.button.primary:disabled {
    background-color: #ccc !important;
    border-color: #ccc !important;
    color: #888 !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

/* Button Spinner */
.button-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: button-spin 1s linear infinite;
    margin-right: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.button.loading .button-spinner {
    opacity: 1;
}

.button.loading {
    position: relative;
    color: #888 !important;
    pointer-events: none;
}

@keyframes button-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Form Elements */
/* Form Elements - Premium Standardization */
input,
textarea,
select {
    width: 100%;
    padding: 0 16px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    /* Smooth, modern radius */
    box-sizing: border-box;
    font-family: inherit;
    font-size: 15px;
    color: var(--text-color);
    background-color: var(--white);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;

    /* Standard Height for Inputs/Selects */
    min-height: 42px;
    line-height: normal;
    /* Ensures text centering vertically */
}

/* Specifics for Textarea */
textarea {
    min-height: 120px;
    padding: 12px 16px;
    /* Restore vertical padding for multiline */
    resize: vertical;
    line-height: 1.5;
}

/* Focus State - Premium Teal Glow */
input:focus,
textarea:focus,
select:focus {
    border-color: var(--verdigris);
    outline: none;
    box-shadow: 0 0 0 3px rgba(67, 179, 174, 0.15);
    /* Soft teal ring */
}

/* Disabled State */
input:disabled,
textarea:disabled,
select:disabled {
    background-color: #f5f7fa !important;
    border-color: #e1e4e8 !important;
    color: #a0aec0 !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
}

/* Placeholder Styling */
::placeholder {
    color: #9ca3af;
    opacity: 1;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group {
    margin-bottom: 20px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
    gap: 15px;
}

/* Tables (Generic) */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

th,
td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--light-background);
    font-weight: bold;
}

/* Flash Messages */
.messages-container {
    margin: 20px 0;
    padding: 0;
}

.messages-container .message {
    padding: 12px 16px;
    margin-bottom: 10px;
    border-radius: 8px;
    font-weight: 500;
    border: 1px solid;
}

.messages-container .message-success {
    background-color: #e8f5e9;
    border-color: var(--beaver-green);
    color: #2e7d32;
}

.messages-container .message-error {
    background-color: #ffebee;
    border-color: #f44336;
    color: #c62828;
}

.messages-container .message-info {
    background-color: #e3f2fd;
    border-color: #2196f3;
    color: #1565c0;
}

/* Feedback Tab */
.feedback-tab {
    position: fixed;
    top: 40%;
    right: 35px;
    transform: translateY(-50%) rotate(-90deg);
    transform-origin: right center;
    background-color: var(--verdigris);
    color: white !important;
    padding: 10px 20px;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    text-decoration: none;
    z-index: 10000;
    box-shadow: 0 -4px 12px rgba(75, 54, 33, 0.15);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
    cursor: pointer;
    margin-right: -5px;
}

.feedback-tab:hover {
    background-color: var(--cafe-noir);
    margin-right: 0px;
}

@media (max-width: 1024px) {
    .feedback-tab {
        display: none;
    }
}

/* Footer */
.site-footer {
    padding: 40px 0;
    text-align: center;
    color: var(--light-text-color);
}

/* Generic Utilities */
.card {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
}

.badge {
    display: inline-block;
    font-size: 0.75em;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    margin-left: 8px;
}

/* Global Responsive Adjustments */
@media (max-width: 768px) {
    body {
        font-size: 16px;
        padding: 0;
    }

    main {
        padding: 0 15px;
    }

    header {
        height: 60px;
        position: relative;
        padding: 0 15px;
        justify-content: space-between;
    }

    header>div:first-child {
        width: 100%;
        justify-content: space-between;
    }

    .mobile-only-avatar {
        display: block;
    }

    .desktop-nav {
        display: none;
    }

    .logo {
        font-size: 24px;
    }

    .logo img {
        width: 40px;
        height: 40px;
    }

    .button {
        padding: 8px 12px;
        font-size: 14px;
    }

    input,
    textarea,
    select {
        padding: 8px;
        font-size: 16px;
    }

    th,
    td {
        padding: 8px 5px;
    }
}

/* =========================================
   Global Modals & Utilities (Post-Mobile Media Query)
   ========================================= */

/* Feedback Modal Styles */
.feedback-modal-hidden {
    display: none;
}

.feedback-modal-content {
    max-width: 500px;
}

.feedback-textarea {
    min-height: 150px;
}

/* Impersonation Banner */
.impersonation-banner {
    background-color: #d32f2f;
    color: white;
    padding: 8px 20px;
    text-align: center;
    font-weight: bold;
    position: relative;
    z-index: 1000;
}

.impersonation-form {
    display: inline;
    margin-left: 15px;
}

.impersonation-stop-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 2px 8px;
    font-size: 0.9em;
    cursor: pointer;
    border-radius: 3px;
}

/* Mobile Nav */
.refer-link {
    color: var(--verdigris);
    font-weight: 500;
}

/* Global Modals */
.modal-hidden {
    display: none !important;
}

.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 30px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    animation: modal-fade-in 0.3s ease-out;
}

@keyframes modal-fade-in {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Feedback Modal Specific Overrides */
.feedback-modal-hidden {
    display: none !important;
}

.feedback-modal-content {
    max-width: 500px;
}

.feedback-textarea {
    min-height: 150px;
}

/* Ensure modal is displayed when active class is removed */
.modal:not(.feedback-modal-hidden):not(.modal-hidden) {
    display: flex !important;
}