/*
* CJPC - PROFESSIONAL MOBILE-FIRST DASHBOARD STYLING
* Goal: Clean, Modern, App-Like Look for all elements (Dashboards, Forms, Tables)
*/

/* ----------------------------------- */
/* 1. GLOBAL RESET & CONTAINERS */
/* ----------------------------------- */
#cjpc-dashboard-wrapper, #cjpc-profile-editor-wrapper, #cjpc-request-form-wrapper, 
#cjpc-apply-form-wrapper, #cjpc-student-list-wrapper, #cjpc-drive-form-wrapper, #cjpc-auth-wrapper {
    max-width: 1200px;
    margin: 0 auto; 
    padding: 0;
    font-family: 'Arial', sans-serif;
    background-color: #f0f2f5; /* Light grey background for app-like contrast */
}

/* Header & Titles */
.cjpc-dash-title {
    background-color: #004a7c; /* Deep Blue header */
    color: white;
    font-size: 1.5em;
    padding: 15px 20px;
    margin: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cjpc-dash-desc {
    padding: 10px 20px;
    margin: 0 0 15px 0;
    color: #555;
}

/* Card Styling (Clean and Elevated) */
.cjpc-card {
    background-color: #ffffff;
    padding: 15px;
    border-radius: 8px; /* Rounded corners for modern look */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); /* Soft shadow */
    margin: 0 20px 20px 20px;
    border-left: 5px solid transparent; /* Highlight for specific cards */
}
.cjpc-card h3 {
    color: #004a7c;
    margin-top: 0;
    font-size: 1.2em;
}

/* Stat Cards */
.cjpc-grid-3 {
    display: grid;
    gap: 15px;
    grid-template-columns: 1fr 1fr 1fr;
    margin: 0 20px 20px 20px;
}
.cjpc-stat-value {
    font-size: 2em;
    font-weight: 700;
    color: #34495e;
    margin: 5px 0 0 0;
}
.cjpc-stat-card h4 {
    color: #7f8c8d;
    font-size: 0.9em;
    margin: 0;
}
.cjpc-note-link {
    font-size: 0.85em;
    color: #007bff;
    text-decoration: none;
    display: block;
    margin-top: 5px;
}

/* ----------------------------------- */
/* 2. TAB STYLES & NAVIGATION */
/* ----------------------------------- */
.cjpc-tabs {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    background-color: #ffffff; 
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin: 0; 
    padding: 0 20px;
}
.cjpc-tab-link {
    background-color: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 12px 15px;
    transition: 0.3s;
    font-size: 15px;
    color: #555;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 3px solid transparent;
}
.cjpc-tab-link.active {
    color: #004a7c;
    font-weight: bold;
    border-bottom: 3px solid #004a7c; 
}
.cjpc-tab-content {
    padding: 20px 0;
}

/* ----------------------------------- */
/* 3. FORM INPUTS & UPLOADS */
/* ----------------------------------- */
#cjpc-profile-editor-wrapper, #cjpc-request-form-wrapper, #cjpc-apply-form-wrapper, #cjpc-drive-form-wrapper, #cjpc-auth-wrapper {
    padding-top: 20px;
}
#cjpc-auth-wrapper {
    max-width: 450px; /* Narrower width for auth forms */
    margin-top: 50px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.cjpc-form-group label,
#cjpc-profile-editor-wrapper label, 
#cjpc-auth-wrapper label {
    display: block;
    margin-top: 15px;
    font-weight: 600;
    color: #34495e;
    font-size: 0.9em;
}

.cjpc-input,
.cjpc-form-group input, 
.cjpc-form-group select,
.cjpc-form-group textarea,
#cjpc-profile-editor-wrapper input[type="text"],
#cjpc-profile-editor-wrapper textarea {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #ced4da; 
    border-radius: 4px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    box-sizing: border-box; 
    font-size: 1em;
    transition: border-color 0.2s;
}

.cjpc-input:focus,
.cjpc-form-group input:focus,
#cjpc-profile-editor-wrapper input:focus {
    border-color: #007bff;
    outline: none;
}

/* File Upload Display (Fixed look) */
#cjpc-profile-editor-wrapper input[type="file"],
#cjpc-auth-wrapper input[type="file"] {
    width: 100%;
    padding: 10px 5px; /* Less padding inside file input */
    margin-top: 5px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: #f8f9fa; 
    box-sizing: border-box; 
    font-size: 1em;
}

/* Display for uploaded documents (NEW SECURITY VIEW) */
.cjpc-doc-display {
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    background-color: #f9f9f9;
}
.cjpc-doc-display a {
    color: #007bff;
    text-decoration: underline;
    font-weight: 600;
    font-size: 0.9em;
}
.cjpc-doc-thumb {
    max-width: 50px; 
    max-height: 50px; 
    margin-right: 10px;
    vertical-align: middle;
}
.cjpc-doc-note {
    font-size: 0.8em;
    color: #dc3545; /* Red warning for non-editable */
    margin-top: 5px;
}
.cjpc-no-doc {
    color: #6c757d;
    font-style: italic;
}


/* ----------------------------------- */
/* 4. UTILITY STYLES (Buttons, Tags, Grids) */
/* ----------------------------------- */
.cjpc-btn {
    display: block; 
    width: 100%;
    padding: 12px 15px;
    margin: 15px 0 0 0;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    text-align: center;
    transition: background-color 0.3s, transform 0.1s;
    border: none;
    cursor: pointer;
}
.cjpc-small-btn {
    padding: 8px 12px;
    font-size: 0.8em;
    width: auto; 
    display: inline-block;
}
.cjpc-grid-2, .cjpc-grid-4 {
    display: grid;
    gap: 20px;
    margin-top: 15px;
}
.cjpc-grid-2 {
    grid-template-columns: 1fr 1fr;
}
.cjpc-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}
.cjpc-button-group {
    display: flex;
    gap: 10px;
}
.cjpc-tag {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
}
.cjpc-success-bg { background-color: #28a745; }
.cjpc-error-bg { background-color: #dc3545; }
.cjpc-primary-btn, .cjpc-primary-bg { background-color: #007bff; color: white; }
.cjpc-secondary-bg { background-color: #6c757d; }
.cjpc-pending-bg { background-color: #ffc107; color: #343a40; } /* Yellow for Pending */

/* Interview Token Styling */
.cjpc-token-box {
    background-color: #ecf0f1; 
    border: 2px dashed #004a7c; 
    padding: 15px;
    margin-top: 10px;
    text-align: center;
    font-size: 1.5em;
    font-family: 'Courier New', monospace; 
    letter-spacing: 2px;
    overflow-wrap: break-word; 
    border-radius: 6px;
}

/* ----------------------------------- */
/* 5. DATA TABLE STYLING (Responsive Table) */
/* ----------------------------------- */
.cjpc-data-table-container {
    overflow-x: auto; 
    margin: 20px 20px 0 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.cjpc-data-table thead th {
    background-color: #004a7c;
    color: white;
    padding: 12px 15px;
}
.cjpc-data-table tbody td {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    font-size: 0.9em;
}

/* ----------------------------------- */
/* 6. MOBILE SPECIFIC OPTIMIZATIONS */
/* ----------------------------------- */
@media screen and (max-width: 768px) {
    /* Full-width container on mobile */
    #cjpc-dashboard-wrapper, #cjpc-profile-editor-wrapper, #cjpc-request-form-wrapper, 
    #cjpc-apply-form-wrapper, #cjpc-student-list-wrapper, #cjpc-drive-form-wrapper, #cjpc-auth-wrapper {
        padding: 0;
        margin: 0;
        max-width: 100%;
    }
    
    /* Auth Wrapper should use internal padding on mobile */
    #cjpc-auth-wrapper {
        margin: 0; 
        padding: 10px;
    }
    
    /* Cards and Grids: Use internal padding, not external margin */
    .cjpc-card, .cjpc-grid-3, .cjpc-grid-2, .cjpc-grid-4 {
        margin-left: 10px;
        margin-right: 10px;
    }
    .cjpc-grid-3, .cjpc-grid-2, .cjpc-grid-4 {
        grid-template-columns: 1fr; /* Stack grids vertically */
    }
    
    /* Table Responsive Flip */
    .cjpc-data-table thead { display: none; }
    .cjpc-data-table, .cjpc-data-table tbody, .cjpc-data-table tr, .cjpc-data-table td {
        display: block;
        width: 100%;
    }
    .cjpc-data-table tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 8px;
    }
    .cjpc-data-table td {
        text-align: right;
        padding-left: 50%; 
        position: relative;
    }
    .cjpc-data-table td::before {
        content: attr(data-label); 
        position: absolute;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: #004a7c;
    }
    
    /* Request Actions Stack */
    .cjpc-request-actions {
        flex-direction: column; 
    }
    .cjpc-request-actions a, .cjpc-request-actions button {
        width: 100%;
        margin: 5px 0 0 0;
    }
}

/* --- ADD THIS TO THE END OF cjpc-styles.css --- */

/* Logout Button Position Fix (Mobile Focus) */
.cjpc-dash-title {
    /* Existing styles here */
    position: relative !important; /* Context for absolute positioning */
}

.cjpc-dash-title .cjpc-error-btn {
    position: absolute !important;
    right: 20px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin: 0 !important; /* Remove float margin */
    padding: 5px 10px !important;
    font-size: 0.8em !important;
    border-radius: 4px !important;
}

/* Mobile specific adjustment for title spacing */
@media screen and (max-width: 480px) {
    .cjpc-dash-title {
        padding-right: 90px !important; /* Make space for the Logout button */
    }
}