/* ============================================
   IFC - Admin Stylesheet
   NOTE: Sidebar layout is owned entirely by
   sidebar.php (.ifc-sidebar). This file only
   styles the main content area.
   ============================================ */

/* --------------------------------------------
   Admin Layout
   -------------------------------------------- */
.admin-wrapper {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
    width: 100%;
    background: #f5f6fa;
}

/* Main content fills remaining space next to the sidebar */
.admin-main {
    flex: 1 1 auto;
    min-width: 0;              /* lets flex child shrink below content width */
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;        /* wide children scroll inside, not the page */
    margin-left: 0;
    padding: 0 0 2rem 0;
}

/* Any direct child of .admin-main is capped at the parent width */
.admin-main > * {
    max-width: 100%;
    box-sizing: border-box;
}

/* Common content container used by most admin pages.
   Wrap your page body in <div class="admin-content"> and you're done. */
.admin-content {
    padding: 1.5rem 2rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Safety net for tables, grids, and flex rows that can be wider
   than the viewport on narrow screens. */
.table-responsive,
.form-grid,
.form-row,
.stats-grid,
.dashboard-grid {
    min-width: 0;
}

.form-group input,
.form-group select,
.form-group textarea {
    max-width: 100%;
    box-sizing: border-box;
}

/* --------------------------------------------
   Top Bar
   -------------------------------------------- */
.admin-topbar {
    background: #fff;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e1e8ed;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left h1 {
    margin: 0;
    font-size: 1.5rem;
}

.breadcrumb {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-left: 0.5rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.role-badge {
    background: #3498db;
    color: #fff;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.datetime {
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* --------------------------------------------
   Stats Grid
   -------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem 2rem;
}

.stat-card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon { font-size: 2.5rem; }
.stat-content { flex: 1; }

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: #2c3e50;
}

.stat-label {
    font-size: 0.85rem;
    color: #7f8c8d;
}

/* --------------------------------------------
   Dashboard Grid
   -------------------------------------------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 0 2rem 1.5rem;
}

.dashboard-card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.dashboard-card.full-width {
    grid-column: 1 / -1;
    margin: 0 2rem 1.5rem;
}

.dashboard-card h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: #2c3e50;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header h3 { margin: 0; }

/* --------------------------------------------
   Status Bars
   -------------------------------------------- */
.status-bars {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.status-bar-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.status-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #2c3e50;
}

.status-bar-track {
    height: 6px;
    background: #ecf0f1;
    border-radius: 3px;
    overflow: hidden;
}

.status-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* --------------------------------------------
   Activity List
   -------------------------------------------- */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.activity-icon { font-size: 1.2rem; }

.activity-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.activity-time {
    margin-left: auto;
    font-size: 0.8rem;
    color: #95a5a6;
}

/* --------------------------------------------
   Admin Table
   -------------------------------------------- */
.table-responsive { overflow-x: auto; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    text-align: left;
    padding: 0.8rem 0.5rem;
    border-bottom: 2px solid #ecf0f1;
    font-size: 0.85rem;
    color: #7f8c8d;
    text-transform: uppercase;
    font-weight: 600;
}

.admin-table td {
    padding: 0.8rem 0.5rem;
    border-bottom: 1px solid #ecf0f1;
    font-size: 0.9rem;
}

.admin-table tr:hover { background: #f8f9fa; }

/* --------------------------------------------
   Status Badges
   -------------------------------------------- */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-draft        { background: #95a5a6; color: #fff; }
.status-submitted    { background: #3498db; color: #fff; }
.status-verification { background: #f39c12; color: #fff; }
.status-approved     { background: #2ecc71; color: #fff; }
.status-active       { background: #1abc9c; color: #fff; }
.status-rejected     { background: #e74c3c; color: #fff; }
.status-inactive     { background: #7f8c8d; color: #fff; }

/* --------------------------------------------
   Buttons
   -------------------------------------------- */
.btn-sm {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: #3498db;
    color: #fff;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.btn-sm:hover { background: #2980b9; color: #fff; }

.btn-sm-danger { background: #e74c3c; }
.btn-sm-danger:hover { background: #c0392b; }

.btn-sm-success { background: #2ecc71; }
.btn-sm-success:hover { background: #27ae60; }

.btn-sm.btn-edit {
    background-color: #f39c12;
    margin-right: 0.25rem;
}
.btn-sm.btn-edit:hover { background-color: #e67e22; }

.btn-sm.btn-delete {
    background: #e74c3c;
    color: #fff;
    border: none;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
}
.btn-sm.btn-delete:hover { background: #c0392b; }

/* --------------------------------------------
   Text Utilities
   -------------------------------------------- */
.text-center  { text-align: center; }
.text-muted   { color: #7f8c8d; }
.text-success { color: #2ecc71; }
.text-danger  { color: #e74c3c; }
.text-warning { color: #f39c12; }

/* ============================================
   FORM STYLES - Intake / Edit Application
   ============================================ */

.admin-form {
    padding: 0 2rem;
    max-width: 1200px;
}

.form-section {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.form-section h3 {
    margin: 0 0 1.25rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #ecf0f1;
    color: #2c3e50;
    font-size: 1.05rem;
    font-weight: 600;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.form-group { margin-bottom: 1.25rem; }
.form-group:last-child { margin-bottom: 0; }

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: #34495e;
    font-size: 0.875rem;
}

.form-group .required {
    color: #e74c3c;
    font-weight: bold;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    color: #2c3e50;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.12);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: #b2bec3; }

.form-group textarea {
    resize: vertical;
    min-height: 70px;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237f8c8d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1.5rem 2rem;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    justify-content: flex-end;
    align-items: center;
}

.form-actions .btn-primary,
.form-actions .btn-secondary,
.form-actions .btn-cancel {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.2s, transform 0.1s;
    line-height: 1.4;
}

.form-actions .btn-primary:active,
.form-actions .btn-secondary:active,
.form-actions .btn-cancel:active { transform: scale(0.98); }

.form-actions .btn-primary { background-color: #2ecc71; color: #fff; }
.form-actions .btn-primary:hover { background-color: #27ae60; color: #fff; }

.form-actions .btn-secondary { background-color: #3498db; color: #fff; }
.form-actions .btn-secondary:hover { background-color: #2980b9; color: #fff; }

.form-actions .btn-cancel { background-color: #ecf0f1; color: #7f8c8d; }
.form-actions .btn-cancel:hover { background-color: #dfe6e9; color: #2c3e50; }

/* --------------------------------------------
   Alerts
   -------------------------------------------- */
.alert {
    margin: 0 2rem 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.alert-error {
    background-color: #fdeaea;
    border-left: 4px solid #e74c3c;
    color: #c0392b;
}

.alert-error ul {
    margin: 0;
    padding-left: 1.25rem;
}

.alert-error li { margin-bottom: 0.25rem; }
.alert-error li:last-child { margin-bottom: 0; }

.alert-success {
    background-color: #eafaf1;
    border-left: 4px solid #2ecc71;
    color: #27ae60;
}

/* ============================================
   RESPONSIVE (content only — sidebar handled
   entirely by sidebar.php)
   ============================================ */

@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    /* On mobile the sidebar is out of flow (fixed drawer),
       so the wrapper no longer needs to be flex. */
    .admin-wrapper { display: block; }

    .admin-main { margin-left: 0; }

    .admin-content { padding: 1rem; }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        padding: 1rem;
    }

    .admin-topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 1rem;
    }

    .dashboard-grid { padding: 0 1rem 1rem; }
    .dashboard-card.full-width { margin: 0 1rem 1rem; }
}

@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr; }
    .admin-form { padding: 0 1rem; }
    .admin-content { padding: 1rem 0.75rem; }
    .alert { margin: 0 1rem 1rem; }
    .form-section { padding: 1.25rem; }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .form-actions {
        flex-direction: column-reverse;
        padding: 1.25rem;
    }

    .form-actions .btn-primary,
    .form-actions .btn-secondary,
    .form-actions .btn-cancel { width: 100%; }
}