@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;500;600&display=swap');

*,
*:before,
*:after {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

body {
    background-color: #f0f4f8; /* Light background */
    font-family: 'Poppins', sans-serif;
    color: #333; /* Dark text */
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden; 
}

/* Background Shapes */
.background {
    width: 430px;
    height: 520px;
    position: fixed; /* Fixed so it stays behind */
    transform: translate(-50%, -50%);
    left: 50%;
    top: 50%;
    z-index: -1;
    pointer-events: none;
}

.background .shape {
    height: 200px;
    width: 200px;
    position: absolute;
    border-radius: 50%;
    opacity: 0.6;
}

.shape:first-child {
    background: linear-gradient(#1845ad, #23a2f6);
    left: -80px;
    top: -80px;
}

.shape:last-child {
    background: linear-gradient(to right, #ff512f, #f09819);
    right: -30px;
    bottom: -80px;
}

/* --- Layout Wrappers --- */

/* Login Form Center */
body > form {
    width: 400px;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    padding: 40px 30px;
}

/* Dashboard Wrapper for Sidebar Layout */
.dashboard-wrapper {
    display: flex;
    width: 1600px; /* User requested width */
    max-width: 95vw;
    height: 80vh; /* Fixed height for dashboard, internal scroll */
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.1);
    border-radius: 15px;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 200px;
    background: rgba(255, 255, 255, 0.5);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
}

.user-info {
    margin-bottom: 40px;
    text-align: center;
}

.user-info h3 {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.user-info small {
    color: #7f8c8d;
    font-size: 12px;
}

.sidebar nav a {
    display: block;
    padding: 12px 15px;
    margin-bottom: 10px;
    color: #57606f;
    text-decoration: none;
    border-radius: 8px;
    transition: 0.3s;
    font-weight: 500;
}

.sidebar nav a:hover, .sidebar nav a.active {
    background-color: #23a2f6;
    color: white;
    box-shadow: 0 4px 10px rgba(35, 162, 246, 0.3);
}

.logout-link {
    margin-top: auto; /* Push to bottom */
    color: #e74c3c !important;
}

.logout-link:hover {
    background-color: #ffebee !important;
    color: #c0392b !important;
    box-shadow: none !important;
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 20px 30px;
    overflow-y: auto; /* Scroll info */
}

/* Common Styles */
h2 {
    font-size: 24px;
    color: #2c3e50;
}

/* Form Styles */
label {
    display: block;
    margin-top: 20px;
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

input {
    display: block;
    height: 45px;
    width: 100%;
    background-color: #ffffff;
    border: 1px solid #dfe6e9; 
    border-radius: 6px;
    padding: 0 15px;
    margin-top: 8px;
    font-size: 14px;
    transition: 0.3s;
}

input:focus {
    border-color: #23a2f6;
    outline: none;
}

::placeholder {
    color: #b2bec3;
}

button {
    margin-top: 30px;
    width: 100%;
    background-color: #23a2f6;
    color: #ffffff;
    padding: 12px 0;
    border: none;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    background-color: #1e90ff;
    box-shadow: 0 5px 15px rgba(30, 144, 255, 0.3);
}

.alert {
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 6px;
    font-size: 14px;
    background: rgba(231, 76, 60, 0.1);
    color: #c0392b;
    border: 1px solid rgba(231, 76, 60, 0.2);
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th, td {
    padding: 8px 10px;
    text-align: left;
    font-size: 13px;
    border-bottom: 1px solid #f1f2f6;
}

th {
    background-color: #f8f9fa;
    color: #7f8c8d;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

tr:hover {
    background-color: #f1f2f6;
}

td {
    color: #2c3e50;
    white-space: nowrap; /* Prevent wrapping for cleaner look */
}

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.success {
    background-color: rgba(46, 204, 113, 0.15);
    color: #27ae60;
}

.status-badge.fail {
    background-color: rgba(231, 76, 60, 0.15);
    color: #c0392b;
}

/* Chart Container & Stats Wrapper */
.stats-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
}

/* Chart Container */
.chart-container-full {
    height: 220px;
    width: 100%;
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

.chart-container {
    height: 250px;
    flex: 1;
    min-width: 300px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

/* Stats Cards */
.stats-cards, .stats-row {
    flex: 1;
    min-width: 250px;
    display: flex;
    gap: 15px;
}

.stats-cards {
    flex-direction: column;
}

/* User stats row always horizontal if possible */
.stats-row {
     flex-direction: row;
     flex-wrap: wrap;
}

/* On mobile, stats-row stacks */
@media (max-width: 768px) {
    .stats-row {
        flex-direction: column;
    }
}

.stat-card {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    flex: 1; /* Distribute height equally */
}

.stat-card h4 {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 5px;
    font-weight: 500;
}

.stat-card .number {
    font-size: 28px;
    font-weight: 600;
    color: #2c3e50;
}

.stat-card .percentage {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    font-weight: 500;
    opacity: 0.2;
}

/* Specific Card Colors */
.stat-card.total {
    border-left: 4px solid #3498db;
}
.stat-card.total .number { color: #3498db; }

.stat-card.success {
    border-left: 4px solid #2ecc71;
}
.stat-card.success .number { color: #2ecc71; }
.stat-card.success .percentage { color: #2ecc71; opacity: 0.8; font-size: 18px; top: 20px; transform: none; font-weight: 600; }

.stat-card.fail {
    border-left: 4px solid #e74c3c;
}
.stat-card.fail .number { color: #e74c3c; }
.stat-card.fail .percentage { color: #e74c3c; opacity: 0.8; font-size: 18px; top: 20px; transform: none; font-weight: 600; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    gap: 5px;
}

.pagination a {
    color: #23a2f6;
    padding: 8px 16px;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 5px;
    transition: 0.3s;
    font-size: 14px;
    background: white;
}

.pagination a.active {
    background-color: #23a2f6;
    color: white;
    border: 1px solid #23a2f6;
}

.pagination a:hover:not(.active) {
    background-color: #f1f2f6;
}

/* Pagination Dots */
.pagination-dots {
    padding: 8px 10px;
    color: #999;
    font-weight: 600;
}


/* Login Page Specific Overrides to keep it centered */
body > form h3 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 20px;
    color: #333;
}

/* Pagination Jump */
.pagination-jump {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 15px;
    padding-left: 15px;
    border-left: 1px solid #ddd;
}

.pagination-jump input {
    width: 60px;
    height: 35px;
    margin-top: 0 !important;
    text-align: center;
    padding: 0 5px;
}

.pagination-jump button {
    width: auto;
    margin-top: 0 !important;
    padding: 5px 15px;
    height: 35px;
    font-size: 14px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.text-center {
    text-align: center !important;
}

.action-btn {
    padding: 6px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    margin: 0 4px;
    color: white;
    width: auto !important;
    display: inline-block !important;
    transition: all 0.2s ease;
    font-weight: 500;
}

.action-btn:hover {
    filter: brightness(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.edit-btn { background-color: #3498db; }
.delete-btn { background-color: #e74c3c; }

/* Responsive */
@media (max-width: 768px) {
    .dashboard-wrapper {
        flex-direction: column;
        height: auto;
        min-height: 80vh;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(0,0,0,0.05);
        padding: 20px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .user-info {
        margin-bottom: 0;
        text-align: left;
    }

    .sidebar nav {
        display: flex;
        gap: 10px;
    }
    
    .sidebar nav a {
        padding: 5px 10px;
        font-size: 12px;
        margin-bottom: 0;
    }
    
    .main-content {
        padding: 20px;
    }
    
    body > form {
        width: 90%;
    }
}
