/* 
   File: style.css
   Purpose: Modern Design System & Global Styling 
   Theme: Professional, Admin-Focused, Blue/Gray Palette
*/

/* --- Variables & Reset --- */
:root {
    --primary-color: #2563eb;
    /* Modern Blue */
    --primary-hover: #1d4ed8;
    --secondary-color: #475569;
    /* Slate Gray */
    --danger-color: #ef4444;
    /* Red */
    --success-color: #10b981;
    /* Emerald Green */
    --warning-color: #f59e0b;
    /* Amber */

    --bg-body: #f1f5f9;
    /* Light Gray Blue BG */
    --bg-card: #ffffff;

    --text-main: #1e293b;
    /* Dark Slate */
    --text-muted: #64748b;

    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --radius: 0.5rem;
}

* {
    box-sizing: border-box;
}

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

/* --- Layout Wrappers --- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* --- Navigation --- */
.main-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.brand-logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
}

.logout-link {
    color: var(--danger-color) !important;
}

/* --- Typography --- */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;
    color: var(--text-main);
}

h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-weight: 600;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* --- Forms & Inputs --- */
label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    color: var(--text-main);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="month"],
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background-color: #fff;
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    color: var(--text-main);
}

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

/* --- Buttons --- */
.button,
button,
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    gap: 0.5rem;
}

.button-primary,
button[type="submit"]:not(.button-danger) {
    background-color: var(--primary-color);
    color: white;
}

.button-primary:hover,
button[type="submit"]:not(.button-danger):hover {
    background-color: var(--primary-hover);
}

.button-danger,
.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.button-danger:hover {
    background-color: #dc2626;
}

.button-secondary {
    background-color: #e2e8f0;
    color: var(--text-main);
}

.button-secondary:hover {
    background-color: #cbd5e1;
}

.button-full {
    width: 100%;
}

/* --- Tables --- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th {
    background: #f8fafc;
    text-align: left;
    padding: 0.8rem 1rem;
    font-weight: 600;
    color: var(--secondary-color);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

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

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

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-neutral {
    background: #f1f5f9;
    color: #475569;
}

/* --- Login Page --- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
    padding: 1rem;
}

.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: 1rem;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: block;
}

/* --- Dashboard Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.stat-icon {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-main);
}

.stat-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* --- Messages / Feed --- */
.message-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    overflow: hidden;
}

.message-header {
    background: #f8fafc;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.message-body {
    padding: 1.25rem;
}

/* --- Summary Cards for Reports --- */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.summary-icon {
    background: #eff6ff;
    color: var(--primary-color);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.summary-info h4 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.summary-info .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

/* --- Filter Form Grid --- */
.filter-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Prevents grid blowout */
}

.filter-group label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    /* Prevent label wrapping causing layout shifts */
}

/* Specific fix for the dual-input date range */
.filter-group input[type="date"] {
    min-width: 0;
    /* Allow shrinking if needed */
}

.filter-actions {
    display: flex;
    gap: 1rem;
    padding-bottom: 2px;
}

/* --- Utilities --- */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.flex {
    display: flex;
}

.gap-2 {
    gap: 0.5rem;
}

.justify-between {
    justify-content: space-between;
}

.items-center {
    align-items: center;
}

/* --- Responsive Nav --- */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .filter-form-grid {
        grid-template-columns: 1fr;
    }
}

/* --- External Font & Icon Injection --- */
/* Note: We will add <link> tags in PHP files for fonts/icons */