/* =================================================================== */
/* === General Page & Layout === */
/* =================================================================== */

body {
    font-family: sans-serif;
    background-color: #f7fafc;
    color: #2d3748;
    margin: 0;
    padding: 2em;
}

.container {
    background-color: white;
    padding: 2em;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* =================================================================== */
/* === Header === */
/* =================================================================== */

.header-container {
    display: flex;
    align-items: center;
    margin-bottom: 2em;
}

.header-logo {
    height: 96px;
    width: auto;
    margin-right: 1.5rem;
}

.header-title {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.header-title-black {
    color: #1a202c;
}

.header-title-red {
    color: #6A0DAD; /* Purple */
}

/* =================================================================== */
/* === Form Elements === */
/* =================================================================== */

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    margin-bottom: 1em;
    align-items: center; /* Better vertical alignment for the checkbox row */
}

input.gr-textbox, .gr-dropdown {
    padding: 6px 8px !important;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-size: 1rem;
    flex-grow: 1;
}

.search-button {
    width: 290px !important;
    margin: 1em auto !important;
    display: block !important;
    padding: 10px 15px;
    background-color: #4a5568;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-button:hover {
    background-color: #2d3748;
}

/* =================================================================== */
/* === Results Table === */
/* =================================================================== */

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5em;
    table-layout: fixed;
    word-wrap: break-word;
}

.results-table th, .results-table td {
    border: 1px solid #e2e8f0;
    padding: 12px;
    text-align: left;
    vertical-align: top;
}

.results-table th {
    background-color: #f7fafc;
    font-weight: bold;
}

.results-table tr:nth-child(even) {
    background-color: #f7fafc;
}

/* --- Column Widths --- */

.results-table .col-url {
    width: 20%;
}

.results-table .col-logo {
    width: 4%;
}

.results-table .col-speaker {
    width: 4%;
}

.results-table .col-framing,
.results-table .col-score {
    width: 4%;
}

/* =================================================================== */
/* === Pagination === */
/* =================================================================== */

.pagination-row {
    display: flex;
    justify-content: center !important;
    gap: 8px !important;
    margin: 1em 0;
}

.page-button {
    /* max-width: 32px; */
    display: inline-block !important;
    margin: 1.2em auto !important;
    min-width: 60px !important;
    margin: 0 4px;
    padding: 10px 15px;
    text-decoration: none;
    color: #4a5568;
    background-color: #edf2f7;
    border-radius: 4px;
    text-align: center;
    transition: background-color 0.3s;
}

.page-button:hover {
    background-color: #e2e8f0;
}

/* =================================================================== */
/* === Dynamic Content (JavaScript) === */
/* =================================================================== */

.show-more-link {
    color: #3b82f6;
    cursor: pointer;
    text-decoration: underline;
    font-weight: bold;
    font-size: 0.9em;
    margin-left: 0.5em;
}

.show-more-link:hover {
    color: #1d4ed8;
}

/* ... inside the Form Elements section ... */

.clear-button {
    background: none;
    border: none;
    color: #9ca3af; /* A light gray color */
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9em;
    padding: 0 0.5em;
    flex-shrink: 0; /* Prevent the button from shrinking */
}

.clear-button:hover {
    color: #4b5563; /* Darken on hover */
}


/* =================================================================== */
/* === User Actions & Logout Button === */
/* =================================================================== */

.user-actions {
    display: flex;
    justify-content: flex-end; /* This correctly aligns the button to the right */
    margin-bottom: 1.5em;

    /* THE FIX: Add this line to ensure it's above the form on all screen sizes */
    width: 100%;
}

/* === User Info & Avatar === */
.user-info {
    display: flex;
    align-items: center;
    margin-right: auto; /* Pushes the logout button to the far right */
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%; /* Makes it a circle */
    margin-right: 0.75em;
}

.user-name {
    font-weight: 600;
    color: #374151;
}

/* === Logout button === */

.logout-button {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-button:hover {
    background-color: #e2e8f0;
    border-color: #cbd5e0;
}

/* =================================================================== */
/* === HAMBURGER MENU & SIDENAV === */
/* =================================================================== */

/* --- The Hamburger Icon --- */
#hamburger-menu-button {
    cursor: pointer;
    position: absolute;
    top: 2.5em;
    left: 2em;
    z-index: 2; /* Ensures it's clickable above other content */
}

#hamburger-menu-button span {
    display: block;
    width: 33px;
    height: 4px;
    margin-bottom: 5px;
    position: relative;
    background: #6b7280;
    border-radius: 3px;
    z-index: 1;
}

/* --- The Sidenav Panel --- */
.sidenav {
    height: 100%; /* Full-height */
    width: 0; /* 0 width - change this with JavaScript */
    position: fixed; /* Stay in place */
    z-index: 10; /* Stay on top */
    top: 0;
    left: 0;
    background-color: #f8fafc;
    overflow-x: hidden; /* Disable horizontal scroll */
    padding-top: 30px; /* Place content 60px from the top */
    transition: 0.4s; /* 0.4 second transition effect to slide in the sidenav */
    border-right: 1px solid #e2e8f0;
    box-shadow: 3px 0px 15px -5px rgba(0,0,0,0.1);
}

/* Class added by JavaScript to open the menu */
.sidenav.open {
    width: 300px; /* Width of the menu when open */
}

/* The "Close" button (X) */
.sidenav .close-btn {
    position: absolute;
    top: 0;
    right: 25px;
    font-size: 36px;
    margin-left: 50px;
    color: #818181;
    text-decoration: none;
}
.sidenav .close-btn:hover {
    color: #1a202c;
}

/* --- Sidenav Content --- */
.sidenav-profile {
    padding: 1px 1px 1px 15px;
    display: flex;
    align-items: flex-start; /* Align avatar with the first row (name) */
    border-bottom: 1px solid #e2e8f0;
    /* padding-bottom: 1.5em; */
}

.sidenav-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 15px;
}

.sidenav-user-details {
    display: flex;
    flex-direction: column;
}

.sidenav-user-name {
    font-size: 1.1em;
    font-weight: 700;
    color: #1a202c;
}

.sidenav-user-email {
    font-size: 0.9em;
    color: #6b7280;
}

/* Company logo area under user details */
.company-logo-container {
    width: 100%;
    max-height: 100px;
    min-height: 60px; /* keep layout predictable even without a logo */
    /* padding: 8px 0; */
    display: flex;
    align-items: center;
    justify-content: center;
}

.company-logo-image {
    max-width: 100%;
    max-height: 100px;
    height: auto;
    width: auto;
    object-fit: contain;
}

/* Find the existing .sidenav-logout rule and replace it with this one */
.sidenav-logout {
    /* position: absolute; and bottom: have been removed */
    /* It will now appear directly below the profile section */
    width: 100%;
    padding: 8px 32px;
    /*margin-top: 1.5em; /* Adds some nice spacing above the logout link */
    border-top: 1px solid #e2e8f0; /* Adds a separator line */
    padding-top: 1em;
}

/* --- Sidenav Menu Items --- */
.sidenav-menu {
    margin-top: 1.5em;
    padding: 0 16px; /* Add some side padding */
}

.sidenav-item a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    font-size: 1.1em;
    color: #4a5569;
    border-radius: 6px;
    transition: background-color 0.2s ease-in-out;
}

.sidenav-item a:hover {
    background-color: #e2e8f0;
}

.sidenav-item a svg {
    margin-right: 16px;
    width: 22px;
    height: 22px;
    stroke-width: 2.5px;
    color: #6b7280;
}

/* The Logout "link" styled as text */
.logout-link {
    font-size: 1em;
    font-weight: bold;
    color: #6b7280;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: block; /* Makes it easier to click */
}

.logout-link:hover {
    color: #e53e3e; /* Red on hover */
}

/* Basic styles for the footer */
.site-footer {
    text-align: center;
    padding: 2em;
    margin-top: 2em;
    border-top: 1px solid #e2e8f0;
    color: #a0aec0;
    font-size: 0.9em;
}
.site-footer a {
    color: #718096;
    text-decoration: none;
    margin: 0 10px;
}
.site-footer a:hover {
    text-decoration: underline;
}

/* Modal dialogs */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 2em;
    border-radius: 8px;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1em;
    right: 1em;
    font-size: 1.5em;
    color: #555;
    cursor: pointer;
}

.modal-close:hover {
    color: #000;
}

.modal-body-text {
    white-space: pre-wrap;
    line-height: 1.6;
}

/* =================================================================== */
/* === Role Badges === */
/* =================================================================== */

.role-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.badge-admin { background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; }
.badge-god { background: #fde68a; color: #7c2d12; border: 1px solid #fcd34d; }

/* =================================================================== */
/* === Account Page === */
/* =================================================================== */

.account-container { max-width: 820px; margin: 0 auto; }
.profile-header { display:flex; align-items:center; gap:16px; margin: 12px 0 20px; }
.avatar { width:96px; height:96px; border-radius: 12px; background:#f3f4f6; display:flex; align-items:center; justify-content:center; overflow:hidden; border:1px solid #e5e7eb; position: relative; }
.avatar img { width:100%; height:100%; object-fit:cover; display:block; }
.avatar .change-avatar { position:absolute; bottom:4px; right:4px; background:#ffffff; border:1px solid #e5e7eb; border-radius:6px; font-size:12px; padding:2px 6px; cursor:pointer; }
.profile-meta { display:flex; flex-direction:column; gap:4px; }
.profile-meta .email { color:#6b7280; }
.form-card { border:1px solid #e5e7eb; border-radius: 12px; padding: 16px; margin-bottom: 20px; }
.form-card h2 { margin: 0 0 10px; font-size: 1.1rem; }
.form-grid { display:grid; grid-template-columns: 180px 1fr; gap: 10px 14px; align-items:center; }
.form-grid label { color:#374151; font-weight:600; }
.form-grid .field, .form-grid .readonly { width:100%; box-sizing:border-box; padding:8px; border:1px solid #d1d5db; border-radius:8px; }
.form-grid .readonly { background:#f9fafb; color:#6b7280; }
.form-actions { display:flex; justify-content:flex-end; margin-top: 12px; }
.success { color:#16a34a; margin:.25rem 0 .5rem; }
.error { color:#dc2626; }

/* Company chips */
.chips { display:flex; flex-wrap:wrap; gap:8px; margin-top: 4px; }
.chip { display:inline-flex; align-items:center; gap:6px; padding:4px 8px; border:1px solid #e5e7eb; border-radius:999px; font-size:0.85rem; background:#f9fafb; }
.chip .badge { font-size:0.7rem; text-transform:uppercase; color:#065f46; background:#d1fae5; border:1px solid #a7f3d0; border-radius:999px; padding:2px 6px; }

/* Password strength meter */
.pw-meter { display:flex; gap:4px; align-items:center; }
.pw-bars { display:flex; gap:3px; }
.pw-bar { width:28px; height:6px; border-radius:4px; background:#e5e7eb; }
.pw-bar.on-1 { background:#ef4444; }
.pw-bar.on-2 { background:#f59e0b; }
.pw-bar.on-3 { background:#84cc16; }
.pw-bar.on-4 { background:#22c55e; }
.pw-text { font-size:0.85rem; color:#6b7280; margin-left:8px; min-width:70px; }
/* Small status badge for active items */
.badge-active {
    margin: 1.2em auto !important;
    display: inline-block;
    padding: 10px 15px;
    background: #dcfce7; /* light green */
    color: #166534; /* dark green */
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
}

/* Restricted project badge */
.badge-restricted {
    display: inline-block;
    padding: 4px 8px;
    background: #f3e8ff; /* light purple */
    color: #6b21a8; /* dark purple */
    border-radius: 999px;
    font-size: 0.75em;
    font-weight: 600;
    margin-left: 6px;
}
