/* --- Dashboard Page Styles --- */
.dashboard-container {
    padding: 60px 0;
    background-color: var(--bg-color-accent);
    min-height: 70vh;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.dashboard-header h1 {
    color: var(--primary-color);
}

.loading-spinner {
    text-align: center;
    font-size: 1.2rem;
    color: var(--medium-color);
    padding: 40px;
}

/* Styles for the content we will add with JavaScript */
.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--light-color);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px var(--shadow-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.dashboard-table th,
.dashboard-table td {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.dashboard-table th {
    background-color: var(--secondary-color);
    color: var(--dark-color);
}

.status-badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.status-badge.status-new {
    background-color: #e6f7ff;
    color: #005a9c;
}

.status-badge.status-due {
    background-color: #fffbe6;
    color: #d46b08;
}

.status-badge.status-complete {
    background-color: #f6ffed;
    color: #389e0d;
}

/* --- Admin Dashboard Styles --- */
.admin-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.admin-nav-link {
    padding: 10px 20px;
    font-weight: 600;
    color: var(--medium-color);
    border-bottom: 3px solid transparent;
    text-decoration: none;
}

.admin-nav-link:hover {
    color: var(--dark-color);
}

.admin-nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.admin-search-bar {
    margin-bottom: 20px;
}

.admin-search-bar input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: var(--light-color);
    color: var(--dark-color);
}

html.dark-mode .admin-search-bar input {
    background: var(--bg-color-accent);
    color: var(--dark-color);
}

/* --- Admin Dashboard Styles --- */
.admin-filter-bar {
    display: grid;
    /* This automatically fits columns based on available width */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 30px;
    background: var(--bg-color-accent);
    padding: 20px;
    border-radius: var(--border-radius);
}

.admin-filter-bar .form-group {
    margin-bottom: 0;
}

.admin-filter-bar label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark-color);
}

.admin-filter-bar input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: var(--light-color);
    color: var(--dark-color);
}

.admin-filter-bar button {
    width: 100%;
    padding: 12px 15px;
    /* Match the input height */
}

/* Make it stack nicely on smaller screens */
@media (max-width: 992px) {
    .admin-filter-bar {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {

    /* ... inside @media (max-width: 768px) ... */
    .dashboard-header {
        flex-direction: column;
        /* Stack vertically */
        align-items: flex-start;
        /* Align to left */
        gap: 15px;
    }

    /* Ensure the button container fits nicely */
    .dashboard-header>div {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }

    .admin-filter-bar {
        grid-template-columns: 1fr;
    }
}

html.dark-mode .admin-search-bar input {
    background: var(--bg-color-accent);
    color: var(--dark-color);
}

/* --- Fix for Edit Page Form --- */
.form-wrapper fieldset {
    border: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.form-wrapper legend {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--secondary-color);
    width: 100%;
}

/* --- Edit Call Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    /* Add padding so it doesn't touch screen edges */
}

.modal-content {
    max-width: 500px;
    width: 100%;
    margin: 0 auto;

    /* --- THIS IS THE FIX --- */
    max-height: 90vh;
    /* Maximum height is 90% of the screen height */
    overflow-y: auto;
    /* Add a vertical scrollbar if content is too long */
    /* ----------------------- */

    background: var(--light-color);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* Optional: Make the scrollbar look nicer (Webkit only) */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Make date/time input look good */
input[type="datetime-local"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: var(--font-family);
    font-size: 1rem;
    background-color: var(--light-color);
    color: var(--dark-color);
}

html.dark-mode input[type="datetime-local"] {
    border-color: #555;
    background-color: var(--bg-color);
    color: var(--dark-color);
    /* Fix for dark mode date picker text */
    color-scheme: dark;
}