/* Admin Panel Custom Stylesheet */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f3f4f6;
    color: #1f2937;
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 250px;
    background-color: #1e293b;
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    flex-shrink: 0;
}

.sidebar .brand {
    padding: 0 20px 20px;
    border-bottom: 1px solid #334155;
    font-size: 20px;
    font-weight: bold;
    color: #f1f5f9;
    letter-spacing: 0.5px;
}

.sidebar .menu {
    list-style: none;
    margin-top: 20px;
}

.sidebar .menu li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 15px;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

.sidebar .menu li a:hover,
.sidebar .menu li.active a {
    background-color: #334155;
    color: #f8fafc;
    border-left-color: #3b82f6;
}

.sidebar .menu li a .icon {
    margin-right: 12px;
    font-size: 18px;
}

/* Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.top-bar {
    height: 60px;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
}

.top-bar .page-title {
    font-size: 18px;
    font-weight: 600;
}

.top-bar .user-info {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.top-bar .logout-btn {
    padding: 5px 12px;
    background-color: #ef4444;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.top-bar .logout-btn:hover {
    background-color: #dc2626;
}

.container {
    padding: 30px;
    flex-grow: 1;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card .card-data h3 {
    font-size: 14px;
    color: #6b7280;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 5px;
}

.card .card-data p {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
}

.card .card-icon {
    font-size: 36px;
    opacity: 0.2;
}

/* Table Card */
.table-card {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 30px;
}

.table-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.table-container {
    overflow-x: auto;
}

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

th {
    background-color: #f9fafb;
    text-align: left;
    padding: 12px 20px;
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
    text-transform: uppercase;
    border-bottom: 1px solid #e5e7eb;
}

td {
    padding: 16px 20px;
    font-size: 14px;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
}

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

/* Badge/Status */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

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

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

/* Forms & Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #3b82f6;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-danger {
    background-color: #ef4444;
    color: #ffffff;
}

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

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #1f2937;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: #3b82f6;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.alert {
    padding: 12px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Responsive Grid and Panels */
.panels-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

/* Login Page Styling */
.login-body {
    background-color: #0f172a;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background-color: #ffffff;
    width: 100%;
    max-width: 400px;
    border-radius: 12px;
    padding: 35px 30px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.login-card h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #0f172a;
    text-align: center;
}

.login-card p {
    color: #64748b;
    font-size: 14px;
    text-align: center;
    margin-bottom: 30px;
}

/* Quick Results Entry Grid */
.quick-entry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}
.quick-entry-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
}
.quick-entry-box h3 {
    font-size: 14px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 5px;
}
.input-row {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
}
.input-row input {
    text-align: center;
}
.input-row input.panna {
    flex: 3;
}
.input-row input.digit {
    flex: 2;
}

/* Dashboard Header & Date Selection Classes */
.dashboard-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.dashboard-date-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Super Kalyan Box Styling - Large, Bold, Colorful & Stylish */
.super-kalyan-box {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 3px solid #ffc107 !important;
    border-radius: 18px;
    padding: 35px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    margin: 0 auto;
    max-width: 520px;
    width: 100%;
}
.super-kalyan-box h3 {
    font-size: 24px !important;
    background: linear-gradient(45deg, #2563eb, #dc2626);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    font-weight: 800;
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 2px dashed #cbd5e1 !important;
    padding-bottom: 15px;
    letter-spacing: 0.8px;
}
.super-kalyan-box .input-row {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
}
.super-kalyan-box .input-row input {
    font-size: 24px !important;
    font-weight: 700;
    text-align: center;
    height: 60px;
    border-radius: 10px;
    outline: none;
    transition: all 0.2s ease-in-out;
}
.super-kalyan-box .input-row input.input-open {
    border: 2px solid #3b82f6;
    background-color: #eff6ff;
    color: #1d4ed8;
}
.super-kalyan-box .input-row input.input-open:focus {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
    background-color: #ffffff;
}
.super-kalyan-box .input-row input.input-close {
    border: 2px solid #ef4444;
    background-color: #fef2f2;
    color: #b91c1c;
}
.super-kalyan-box .input-row input.input-close:focus {
    border-color: #b91c1c;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25);
    background-color: #ffffff;
}
.super-kalyan-box .btn-submit-result {
    background: linear-gradient(45deg, #10b981, #059669);
    color: #ffffff;
    font-size: 20px;
    font-weight: 800;
    padding: 16px;
    border-radius: 12px;
    border: none;
    width: 100%;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}
.super-kalyan-box .btn-submit-result:hover {
    background: linear-gradient(45deg, #059669, #047857);
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

/* Media Queries for Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    
    /* Sidebar as top-bar nav */
    .sidebar {
        width: 100%;
        padding: 15px 0 10px;
        border-bottom: 1px solid #334155;
    }
    
    .sidebar .brand {
        text-align: center;
        padding-bottom: 10px;
        border-bottom: none;
    }
    
    .sidebar .menu {
        margin-top: 5px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
        padding: 0 10px;
    }
    
    .sidebar .menu li {
        width: auto;
    }
    
    .sidebar .menu li a {
        padding: 8px 12px;
        font-size: 13px;
        border-left: none;
        border-bottom: none;
        border-radius: 6px;
        background-color: #27354a;
        margin-bottom: 0;
    }
    
    .sidebar .menu li.active a,
    .sidebar .menu li a:hover {
        background-color: #3b82f6;
        color: #f8fafc;
    }
    
    /* Top Bar adjustments */
    .top-bar {
        padding: 15px;
        flex-direction: column;
        height: auto;
        gap: 10px;
        text-align: center;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .top-bar .user-info {
        flex-direction: column;
        gap: 8px;
    }
    
    .container {
        padding: 15px;
    }
    
    /* Mobile Form Zoom Prevention */
    .form-control,
    input[type="text"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px !important;
    }
    
    /* 3-Column Compact Stats Grid for Mobile */
    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-bottom: 20px;
    }
    
    .card {
        padding: 10px 5px;
        flex-direction: column;
        align-items: center;
        text-align: center;
        justify-content: center;
    }
    
    .card .card-icon {
        display: none;
    }
    
    .card .card-data h3 {
        font-size: 10px;
        margin-bottom: 2px;
    }
    
    .card .card-data p {
        font-size: 18px;
    }
    
    .panels-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .quick-entry-grid {
        grid-template-columns: 1fr;
    }
    
    /* Tables and forms */
    .table-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        text-align: left;
    }
    
    .table-header form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .table-header form select {
        width: 100% !important;
    }
    
    /* Padding adjustments for table rows on mobile */
    th, td {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    /* Form input & textarea full-width buttons */
    .form-group .btn,
    form > .btn {
        width: 100%;
        text-align: center;
    }
    
    /* Action buttons in tables should stay small and inline */
    td .btn {
        width: auto;
        display: inline-block;
        margin-bottom: 0;
        padding: 4px 8px;
        font-size: 12px;
    }

    /* Dashboard Specific Mobile Rules */
    .dashboard-section-header {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
    }
    .dashboard-date-form {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 8px;
    }
    .dashboard-date-form label {
        font-size: 13px !important;
    }
    .dashboard-date-form input {
        width: auto !important;
        flex-grow: 1;
    }
    .table-card {
        padding: 12px !important;
    }

    /* Super Kalyan Box Mobile Overrides */
    .super-kalyan-box {
        padding: 15px;
    }
    .super-kalyan-box h3 {
        font-size: 18px !important;
    }
    .super-kalyan-box .input-row {
        gap: 6px;
        margin-bottom: 15px;
    }
    .super-kalyan-box .input-row input {
        font-size: 16px !important;
        height: 44px;
        padding: 5px !important;
    }
    .super-kalyan-box .btn-submit-result {
        font-size: 16px;
        padding: 12px;
    }
}
