/* ==========================================================================
   Global Base Rules & Layout Reset
   ========================================================================== */
body {
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f1f5f9;
    color: #1e293b;
    line-height: 1.5;
}

/* ==========================================================================
   Containers & Card Frameworks
   ========================================================================== */
.workspace-wrapper {
    padding: 15px;
    max-width: 1240px;
    margin: 0 auto;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .workspace-wrapper {
        padding: 30px;
    }
}

.card, .form-card {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    width: 100%;
    box-sizing: border-box;
    margin: 10px auto;
}

@media (min-width: 768px) {
    .card, .form-card {
        padding: 2.5rem;
        margin: 20px auto;
    }
}

.card {
    max-width: 450px;
    text-align: center;
}

.form-card {
    max-width: 100%;
}

h2, h3 {
    margin-top: 0;
    color: #0f172a;
}
h2 { text-align: center; margin-bottom: 25px; font-size: 1.4rem; }
h3 { margin-bottom: 15px; font-size: 1.15rem; }

@media (min-width: 768px) {
    h2 { font-size: 1.6rem; }
    h3 { font-size: 1.25rem; }
}

/* ==========================================================================
   Global Responsive Navigation Header Menu
   ========================================================================== */
.top-navbar {
    background-color: #1e293b;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.5px;
    text-align: center;
}

.navbar-menu {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.navbar-menu li {
    flex: 1 1 auto;
    text-align: center;
    min-width: 110px;
}

.navbar-menu a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 6px;
    display: block;
    transition: all 0.2s ease;
}

.navbar-menu a:hover {
    color: #ffffff;
    background-color: #334155;
}

.navbar-menu a.active {
    color: #ffffff;
    background-color: #0284c7;
}

.btn-logout-nav {
    background-color: #ef4444 !important;
    color: #ffffff !important;
}
.btn-logout-nav:hover {
    background-color: #dc2626 !important;
}

/* Tablet & Desktop Navigation Overrides */
@media (min-width: 992px) {
    .top-navbar {
        flex-direction: row;
        justify-content: space-between;
        padding: 0 30px;
        height: 65px;
        gap: 0;
    }
    .navbar-brand {
        text-align: left;
        font-size: 16px;
    }
    .navbar-menu {
        width: auto;
        gap: 15px;
    }
    .navbar-menu li {
        flex: none;
    }
    .navbar-menu a {
        font-size: 14px;
        padding: 8px 16px;
    }
}

/* ==========================================================================
   Form Row Alignments & Input Fields
   ========================================================================== */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #334155;
    font-size: 0.9rem;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 11px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 0.95rem;
    background-color: #ffffff;
    color: #0f172a;
}

.form-group input:focus, .form-group select:focus {
    border-color: #0284c7;
    outline: none;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Adaptive inline flex wrapper turns stackable on smaller screens */
.form-row-inline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.form-row-inline .form-group {
    width: 100%;
}

@media (min-width: 768px) {
    .form-row-inline {
        flex-direction: row;
        gap: 20px;
    }
    .form-row-inline .form-group {
        flex: 1;
    }
}

.submit-btn {
    width: 100%;
    padding: 12px;
    background: #0284c7;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s;
}

.submit-btn:hover {
    background: #0369a1;
}

/* Wrap inline containers on mobile (Fixes edit file attachment wrapper) */
div[style*="display:flex; align-items:center; gap:20px;"],
div[style*="display: flex; gap: 8px;"] {
    flex-wrap: wrap !important;
    gap: 12px !important;
}

/* ==========================================================================
   Notification Banners
   ========================================================================== */
.status-banner, .success-banner, .error-banner, .welcome-banner {
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-weight: 600;
    text-align: center;
    font-size: 0.95rem;
    word-wrap: break-word;
}

.valid-banner, .success-banner {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.invalid-banner, .error-banner {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.welcome-banner {
    background-color: #f8fafc;
    border-left: 5px solid #0284c7;
    text-align: left;
    color: #334155;
}

/* ==========================================================================
   Admin Control Dashboard Structures
   ========================================================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 24px;
    }
}

.dash-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
}

@media (min-width: 768px) {
    .dash-card {
        padding: 24px;
    }
}

.dash-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.dash-card h3 {
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 10px;
}

.dash-card p {
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.dash-btn {
    display: inline-block;
    text-align: center;
    padding: 12px 20px;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
}

.btn-add { background-color: #0284c7; }
.btn-edit { background-color: #10b981; }
.btn-list { background-color: #6366f1; }

/* ==========================================================================
   Failover Verification Search Controls
   ========================================================================== */
.search-box-container {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 25px;
}

@media (min-width: 768px) {
    .search-box-container {
        padding: 20px;
    }
}

.search-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.search-group input {
    flex: 1;
    margin-bottom: 0 !important;
    width: 100%;
}

.search-btn-action {
    background-color: #0f172a;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
}

@media (min-width: 576px) {
    .search-group {
        flex-direction: row;
    }
    .search-btn-action {
        width: auto;
    }
}
.search-btn-action:hover { background-color: #334155; }

/* ==========================================================================
   Directory Display Tables (Responsive Stack Design)
   ========================================================================== */
.table-container {
    margin-top: 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
}

@media (min-width: 768px) {
    .table-container {
        margin-top: 30px;
        padding: 20px;
        overflow-x: auto;
    }
}

.employee-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

/* Native desktop table styling */
.employee-table th, .employee-table td {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.employee-table th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
}

.employee-table tr:hover { background-color: #f1f5f9; }

/* Transform wide tabular listings into clean block profiles on mobile screens */
@media max-width: 767px {
    .employee-table, 
    .employee-table thead, 
    .employee-table tbody, 
    .employee-table th, 
    .employee-table td, 
    .employee-table tr { 
        display: block; 
    }
    
    .employee-table thead {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .employee-table tr {
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        margin-bottom: 15px;
        padding: 10px;
        background: #ffffff;
        box-shadow: 0 2px 4px rgba(0,0,0,0.01);
    }
    
    .employee-table td {
        border: none;
        border-bottom: 1px solid #f1f5f9;
        position: relative;
        padding-left: 45%;
        text-align: right;
        min-height: 24px;
        word-wrap: break-word;
    }
    
    .employee-table td:last-child {
        border-bottom: none;
    }
    
    /* Inject row labels systematically via pseudo CSS elements */
    .employee-table td:before {
        position: absolute;
        left: 10px;
        width: 40%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: 600;
        color: #64748b;
    }
    
    /* Map desktop headings onto corresponding data cells safely */
    .employee-table td:nth-of-type(1):before { content: "Photo"; }
    .employee-table td:nth-of-type(2):before { content: "ID Key"; }
    .employee-table td:nth-of-type(3):before { content: "Full Name"; }
    .employee-table td:nth-of-type(4):before { content: "Designation"; }
    .employee-table td:nth-of-type(5):before { content: "EIN Code"; }
    .employee-table td:nth-of-type(6):before { content: "Contact"; }
    .employee-table td:nth-of-type(7):before { content: "Sex"; }
    .employee-table td:nth-of-type(8):before { content: "DOB"; }
    .employee-table td:nth-of-type(9):before { content: "Expiry Check"; }
    .employee-table td:nth-of-type(10):before { content: "Action"; }
    
    .table-thumbnail {
        float: right;
    }
    
    .action-link {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
        padding: 8px;
    }
}

.table-thumbnail {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
}

.action-link {
    display: inline-block;
    background-color: #0284c7;
    color: white;
    padding: 6px 12px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}
.action-link:hover { background-color: #0369a1; }

.logo-img { width: 140px; height: auto; margin: 0 auto 15px auto; display: block; max-width: 100%; }
.profile-img { width: 140px; height: auto; object-fit: cover; border-radius: 10%; border: 3px solid #e2e8f0; margin: 0 auto 15px auto; display: block; }
.details-table { width: 100%; border-collapse: collapse; margin-top: 15px; }
.details-table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; font-size: 0.9rem; text-align: left; }
.details-table .label { color: #64748b; font-weight: 600; width: 40%; }

/* Optional stylistic styling for multiple profiles */
.profile-wrapper {
    border-bottom: 2px dashed #cbd5e1;
    padding-bottom: 25px;
    margin-bottom: 25px;
}
.profile-wrapper:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.match-badge {
    background-color: #f8fafc;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 10px;
    display: inline-block;
    border: 1px solid #e2e8f0;
}

