/*
 * ALIAS Document Portal — Frontend Styles (v1.3.0)
 * This stylesheet provides a modern, professional, and responsive design
 * for the document portal's main page and components.
 */

/* --- 🎨 Color & Font Variables --- */
:root {
    --adp-primary: #005A9C;      /* Professional Blue */
    --adp-secondary: #3D4A52;    /* Dark Slate Gray */
    --adp-accent-red: #d9534f;   /* Overdue Red */
    --adp-accent-green: #2ecc71; /* Success Green */
    --adp-light-gray: #f4f7f6;
    --adp-border-color: #e1e1e1;
    --adp-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --adp-shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.12);
    --adp-font: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

/* --- 🏛️ Main Container & Header --- */
.alias-docs-portal {
    font-family: var(--adp-font);
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
}

.adp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--adp-primary);
    padding-bottom: 20px;
}

.adp-header h1 {
    color: var(--adp-secondary);
    margin: 0;
    font-size: 28px;
}

/* --- 🔍 Search Bar --- */
.adp-search-container {
    position: relative;
}

#adp-search-input,
#adp-category-search-input {
    min-width: 300px;
    padding: 12px 15px 12px 40px;
    border: 1px solid var(--adp-border-color);
    border-radius: 50px;
    font-size: 16px;
    transition: all 0.3s ease;
}

#adp-search-input:focus,
#adp-category-search-input:focus {
    outline: none;
    border-color: var(--adp-primary);
    box-shadow: 0 0 0 3px rgba(0, 90, 156, 0.2);
}

.adp-search-container .fa-search {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    pointer-events: none;
}

/* --- 🔘 Action Buttons --- */
.adp-actions-container {
    margin-bottom: 30px;
    display: flex;
    gap: 15px;
}

.adp-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    border: 1px solid var(--adp-border-color);
    background-color: #fff;
    color: var(--adp-secondary);
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

.adp-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--adp-shadow);
}

.adp-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.adp-btn-primary {
    background-color: var(--adp-primary);
    color: #fff;
    border-color: var(--adp-primary);
}

/* --- 🗂️ The Category Grid --- */
.adp-category-grid {
    display: grid;
    /* Base responsive grid for smaller screens */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}

/* Force 4 columns on wider screens */
@media (min-width: 1400px) {
    .adp-category-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.adp-category-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    text-decoration: none;
    color: var(--adp-secondary);
    box-shadow: var(--adp-shadow);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-left: 5px solid transparent;
}

.adp-category-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--adp-shadow-hover);
}

.adp-category-card:nth-child(6n+1) { border-color: #3498db; } /* Blue */
.adp-category-card:nth-child(6n+2) { border-color: #2ecc71; } /* Green */
.adp-category-card:nth-child(6n+3) { border-color: #e74c3c; } /* Red */
.adp-category-card:nth-child(6n+4) { border-color: #f1c40f; } /* Yellow */
.adp-category-card:nth-child(6n+5) { border-color: #9b59b6; } /* Purple */
.adp-category-card:nth-child(6n+6) { border-color: #34495e; } /* Dark Blue */

.adp-card-icon { font-size: 48px; margin-bottom: 15px; color: var(--adp-primary); }
.adp-card-title { font-size: 1.25rem; margin: 0 0 10px 0; font-weight: 600; }
.adp-card-count { font-size: 0.9rem; color: #777; background: var(--adp-light-gray); padding: 3px 10px; border-radius: 50px; display: inline-block; }

/* --- 🍞 Breadcrumbs & Section Titles --- */
.adp-breadcrumbs { font-size: 14px; color: #666; margin-bottom: 20px; }
.adp-breadcrumbs a { color: var(--adp-primary); text-decoration: none; }
.adp-breadcrumbs a:hover { text-decoration: underline; }
.adp-breadcrumbs span { color: var(--adp-secondary); font-weight: 600; }
.adp-section-title { margin-top: 40px; margin-bottom: 20px; font-size: 22px; color: var(--adp-secondary); border-bottom: 1px solid var(--adp-border-color); padding-bottom: 10px; }

/* --- 📑 Document Table --- */
.adp-table-container { overflow-x: auto; border: 1px solid var(--adp-border-color); border-radius: 12px; box-shadow: var(--adp-shadow); background: #fff; }
.adp-table { width: 100%; border-collapse: collapse; }
.adp-table th, .adp-table td { padding: 15px; text-align: left; border-bottom: 1px solid var(--adp-border-color); }
.adp-table th { background-color: var(--adp-light-gray); font-weight: 600; color: var(--adp-secondary); font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; }
.adp-table tbody tr:last-child td { border-bottom: none; }
.adp-table tbody tr:hover { background-color: rgba(0, 90, 156, 0.04); }
.adp-doc-title a { font-weight: 600; color: var(--adp-primary); text-decoration: none; }
.adp-doc-title a:hover { text-decoration: underline; }
.adp-review-date.is-overdue { color: var(--adp-accent-red); font-weight: 600; }
.adp-review-date .fa-exclamation-triangle { margin-right: 5px; }
.adp-table-actions { text-align: right; white-space: nowrap; }
.adp-btn-icon { padding: 8px 10px; background: var(--adp-light-gray); color: var(--adp-secondary); border: 1px solid var(--adp-border-color); }
.adp-btn-icon:hover { background: var(--adp-primary); color: #fff; }
.adp-table-empty { text-align: center; padding: 40px; color: #777; }

/* --- MODALS & FORMS --- */
.adp-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; z-index: 10000; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease; }
.adp-modal.is-visible { opacity: 1; visibility: visible; }
.adp-modal-content { background-color: #fff; padding: 30px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); width: 90%; max-width: 500px; position: relative; transform: scale(0.95); transition: transform 0.3s ease; }
.adp-modal.is-visible .adp-modal-content { transform: scale(1); }
.adp-modal-close { position: absolute; top: 10px; right: 15px; background: none; border: none; font-size: 28px; color: #aaa; cursor: pointer; line-height: 1; }
.adp-modal-title { margin-top: 0; margin-bottom: 25px; color: var(--adp-secondary); }
.adp-form-field { margin-bottom: 20px; }
.adp-form-field label { display: block; font-weight: 600; margin-bottom: 8px; color: var(--adp-secondary); }
.adp-form-field .adp-required { color: var(--adp-accent-red); }
.adp-form-field input[type="text"], .adp-form-field input[type="date"], .adp-form-field input[type="file"], .adp-form-field select { width: 100%; padding: 10px; border: 1px solid var(--adp-border-color); border-radius: 8px; font-size: 16px; }
.adp-form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 15px; margin-top: 25px; }
.adp-form-message { font-size: 14px; flex-grow: 1; }
.adp-form-message.success { color: var(--adp-accent-green); }
.adp-form-message.error { color: var(--adp-accent-red); }

/*
 * ===================================================================
 * NEW: AJAX Search Results Dropdown
 * ===================================================================
 */

#adp-search-results-container {
    display: none; /* Hidden by default, shown by JS */
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #fff;
    border: 1px solid var(--adp-border-color);
    border-top: none;
    border-radius: 0 0 16px 16px;
    box-shadow: var(--adp-shadow);
    z-index: 9999;
    max-height: 350px;
    overflow-y: auto;
}

#adp-search-results-container ul {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

#adp-search-results-container li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--adp-secondary);
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

#adp-search-results-container li:last-child a {
    border-bottom: none;
}

#adp-search-results-container li a:hover {
    background-color: var(--adp-light-gray);
    color: var(--adp-primary);
}

#adp-search-results-container .adp-search-message {
    padding: 15px 20px;
    color: #777;
    font-style: italic;
}
/* --- NEW: Login Form Error Message --- */
.adp-login-wrapper .adp-login-error {
    background-color: #fff5f5;
    color: #c53030;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #fc8181;
    margin-bottom: 15px;
    text-align: center;
}
/*
 * ===================================================================
 * NEW: Fullscreen Login Form for Logged-Out Users
 * ===================================================================
 */

body.logged-out .adp-login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #fff;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.adp-login-card {
    max-width: 420px;
    width: 100%;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: var(--adp-shadow);
    border-top: 5px solid var(--adp-primary);
    background-color: #fff;
}

.adp-login-card h2 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 24px;
    color: var(--adp-secondary);
}

.adp-login-card > p {
    text-align: center;
    color: #666;
    margin-bottom: 25px;
}

.adp-login-card .login-form p {
    margin-bottom: 15px;
}

.adp-login-card .login-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--adp-secondary);
}

.adp-login-card .login-form input[type="text"],
.adp-login-card .login-form input[type="password"] {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    font-size: 16px;
    border: 1px solid var(--adp-border-color);
}

.adp-login-card .login-submit input[type="submit"] {
    width: 100%;
    margin-top: 10px;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    border: 1px solid var(--adp-primary);
    background-color: var(--adp-primary);
    color: #fff;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    font-size: 16px;
}
.adp-login-card .login-submit input[type="submit"]:hover {
    opacity: 0.9;
}

.adp-login-card .login-remember {
    font-size: 14px;
}

.adp-login-card .adp-login-error {
    background-color: #fff5f5;
    color: #c53030;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #fc8181;
    margin-bottom: 15px;
    text-align: center;
}
/*
 * ===================================================================
 * FINAL ADDITIONS for 4-Column Layout and Login Form
 * ===================================================================
 */

/* --- Force 4 columns on wider screens --- */
@media (min-width: 1200px) {
    .adp-category-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* --- Fullscreen Login Form --- */
body:has(.adp-login-overlay) {
    overflow: hidden; /* Prevent scrolling of page behind login */
}

/* This is the full-screen white background */
.adp-login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* This is the centered box containing the form */
.adp-login-card {
    max-width: 420px;
    width: 100%;
    padding: 30px 40px;
    border-top: 5px solid var(--adp-primary);
    border-radius: 12px;
    box-shadow: var(--adp-shadow);
    background-color: #f9f9f9;
}

.adp-login-card h2 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 24px;
    color: var(--adp-secondary);
}

.adp-login-card > p {
    text-align: center;
    color: #666;
    margin-bottom: 25px;
}

.adp-login-card .login-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
}

.adp-login-card .login-form input[type="text"],
.adp-login-card .login-form input[type="password"] {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    font-size: 16px;
    border: 1px solid var(--adp-border-color);
}

.adp-login-card .login-submit input[type="submit"] {
    width: 100%;
    margin-top: 10px;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background-color: var(--adp-primary);
    border: 1px solid var(--adp-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.adp-login-card .login-submit input[type="submit"]:hover {
    opacity: 0.9;
}

.adp-login-card .adp-login-error {
    background-color: #fff5f5;
    color: #c53030;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #fc8181;
    margin-bottom: 15px;
    text-align: center;
}
/*
 * ===================================================================
 * DRAG & DROP UPLOAD STYLES
 * ===================================================================
 */

.adp-category-card.is-dropzone {
    border: 2px dashed var(--adp-primary);
    background-color: #f0f8ff; /* Light alice blue */
}

/* This overlay appears on top of the card content when dragging a file over it */
.adp-category-card.is-dropzone::after {
    content: 'Drop Files to Upload';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--adp-primary);
    background-color: rgba(255, 255, 255, 0.85);
    border-radius: 10px;
    z-index: 10;
}

/* -- Progress Modal -- */
#adp-modal-progress .adp-progress-list {
    list-style: none;
    padding: 0;
    margin: 25px 0 0 0;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--adp-border-color);
    border-radius: 8px;
}

#adp-modal-progress .adp-progress-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border-bottom: 1px solid var(--adp-border-color);
    background-color: #fff;
}

#adp-modal-progress .adp-progress-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

#adp-modal-progress .adp-progress-item:last-child {
    border-bottom: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

#adp-modal-progress .adp-progress-filename {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
}

#adp-modal-progress .adp-progress-status {
    font-size: 20px;
    flex-shrink: 0;
}

@keyframes adp-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
#adp-modal-progress .adp-progress-status .fa-spinner {
    color: var(--adp-primary);
    animation: adp-spin 1.5s infinite linear;
}

#adp-modal-progress .adp-progress-status .fa-check-circle {
    color: var(--adp-accent-green);
}

#adp-modal-progress .adp-progress-status .fa-times-circle {
    color: var(--adp-accent-red);
}

#adp-modal-progress .adp-progress-error-message {
    display: block;
    font-size: 12px;
    color: var(--adp-accent-red);
    margin-top: 4px;
}

#adp-modal-progress .adp-modal-close-button {
    text-align: right;
    margin-top: 20px;
}
/*
 * ===================================================================
 * NEW: In-Category Drop Zone
 * ===================================================================
 */

.adp-dropzone {
    border: 3px dashed var(--adp-border-color);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    color: #999;
    margin-bottom: 40px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.adp-dropzone:hover {
    border-color: #aaa;
    color: #666;
}

.adp-dropzone i {
    font-size: 48px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.adp-dropzone p {
    margin: 0;
    font-size: 1.2rem;
}

.adp-dropzone .adp-dropzone-subtext {
    font-size: 0.9rem;
}

/* This style applies when you are dragging a file over the box */
.adp-dropzone.is-dropzone {
    border-color: var(--adp-primary);
    background-color: #f0f8ff; /* Light alice blue */
    color: var(--adp-primary);
}

.adp-dropzone.is-dropzone i {
    color: var(--adp-primary);
    transform: scale(1.1);
}