/* =========================================================
   1. GLOBAL VARIABLES & SYSTEM FONT
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-text: #94a3b8;
    --border: #e2e8f0;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    --radius-md: 8px;
    --radius-lg: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 20px;
}

/* =========================================================
   2. LAYOUT: FRONTEND & BACKEND
   ========================================================= */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.navbar h2 {
    margin: 0;
    color: var(--primary);
    font-weight: 700;
}

.container {
    width: 95%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 0;
}

/* Premium Sidebar */
.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    background: var(--sidebar-bg);
    padding: 24px 16px;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 50;
}

.sidebar a {
    display: block;
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 15px;
    transition: all 0.2s ease;
}

.sidebar a:hover, .sidebar a:active {
    background: var(--sidebar-hover);
    color: #ffffff;
    transform: translateX(4px);
}

.content {
    margin-left: 260px;
    padding: 40px;
    min-height: 100vh;
}

/* =========================================================
   3. COMPONENTS: CARDS, FORMS & BUTTONS
   ========================================================= */
/* Job Cards */
.job-card {
    background: var(--bg-card);
    padding: 32px;
    margin-bottom: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.job-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.job-card h2 {
    margin-bottom: 12px;
    font-size: 22px;
}

.job-card p {
    color: var(--text-muted);
    margin-bottom: 8px;
}

.job-card strong {
    color: var(--text-main);
}

/* Login/Apply Form Box */
.form-box {
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--radius-lg);
    max-width: 480px;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.form-box h2 {
    text-align: center;
    margin-bottom: 24px;
}

/* Form Messages (Success/Error) */
.form-box p {
    background: #e0f2fe;
    color: #0369a1;
    padding: 12px;
    border-radius: var(--radius-md);
    text-align: center;
    font-weight: 500;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Inputs */
input[type="text"], 
input[type="email"], 
input[type="password"], 
input[type="number"], 
input[type="date"], 
input[type="file"], 
textarea {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 15px;
    color: var(--text-main);
    background: #fdfdfd;
    transition: all 0.2s ease;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    background: #ffffff;
}

/* Buttons */
.btn {
    background: var(--primary);
    color: #ffffff;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    text-align: center;
    width: 100%; /* Default width for forms */
}

.job-card .btn, table .btn, .top-bar .btn {
    width: auto; /* Auto width outside of forms */
    margin-top: 15px;
}

.btn:hover {
    background: var(--primary-hover);
}

.btn.delete-btn {
    background: var(--danger);
    margin-top: 0;
}

.btn.delete-btn:hover {
    background: var(--danger-hover);
}

/* =========================================================
   4. DASHBOARD & SPECIFIC PHP LAYOUTS
   ========================================================= */
/* Dashboard Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.stat-card {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    border-left: 5px solid var(--primary);
}

.stat-card h2 {
    margin: 0;
    font-size: 36px;
    color: var(--text-main);
}

.stat-card p {
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 5px;
}

/* Top Bar & Filtering (clients.php) */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 20px;
    flex-wrap: wrap;
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.top-bar h1 {
    margin: 0;
}

.filter-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-form input {
    margin-bottom: 0; /* Override form-box spacing */
    width: auto;
    padding: 10px 14px;
}

.filter-form .btn {
    margin-top: 0;
    padding: 10px 20px;
}

/* =========================================================
   5. MODERN DATA TABLES
   ========================================================= */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border-style: hidden; /* Hides outer borders for seamless look */
    /* This display trick makes tables scroll horizontally on mobile automatically */
    display: block;
    overflow-x: auto;
    white-space: nowrap;
}

table th {
    background: #f1f5f9;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px 20px;
    text-align: left;
    border-bottom: 2px solid var(--border);
}

table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    color: #334155;
    font-size: 14px;
}

table tr:last-child td {
    border-bottom: none;
}

table tr:hover td {
    background-color: #f8fafc;
}

/* Status Pill Badges */
.status-active, .status-expired {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    text-align: center;
}

.status-active {
    background: var(--success-bg);
    color: var(--success-text);
}

.status-expired {
    background: var(--danger-bg);
    color: var(--danger-text);
}



/* =========================================================
   7. PREMIUM LOGIN / AUTH BACKGROUND (Glassmorphism)
   ========================================================= */
.auth-bg {
    /* Uses a dark overlay mixed with a high-end abstract tech/office image */
    background-image: linear-gradient(rgba(15, 23, 42, 0.7), rgba(15, 23, 42, 0.9)), 
                      url('https://images.unsplash.com/photo-1550751827-4bd374c3f58b?q=80&w=2000&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    
    /* Centers the form perfectly on the screen */
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

/* Adjust the container just for the auth page */
.auth-bg .container {
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: center;
}

/* Frosted Glass Effect for the Login Box */
.auth-bg .form-box {
    background: rgba(255, 255, 255, 0.92); /* Slightly transparent white */
    backdrop-filter: blur(12px); /* The frosted glass blur */
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); /* Deep premium shadow */
    border: 1px solid rgba(255, 255, 255, 0.5);
    width: 100%;
    max-width: 420px;
    margin: 0;
    transform: translateY(-5%); /* Bumps it slightly above dead-center for better visual balance */
}

/* =========================================================
   6. RESPONSIVE DESIGN (Mobiles & Tablets)
   ========================================================= */
@media screen and (max-width: 992px) {
    .content {
        padding: 30px 20px;
    }
}

@media screen and (max-width: 768px) {
    /* Transform Sidebar into a horizontal swipeable top-nav */
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        overflow-x: auto;
        padding: 12px;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .sidebar a {
        padding: 10px 16px;
    }
    
    .sidebar a:hover, .sidebar a:active {
        transform: translateY(-2px); /* Vertical pop instead of horizontal */
    }

    .content {
        margin-left: 0;
        padding: 20px 16px;
    }

    .top-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-form {
        width: 100%;
    }

    .filter-form input, .filter-form .btn {
        width: 100%; /* Stack filter inputs on mobile */
    }

    .form-box {
        padding: 24px;
        width: 100%;
    }
    
    .job-card {
        padding: 24px;
    }
}