/* ===========================
   Nivedan Data Entry - Custom Styles
   ========================== */

/* ===========================
   Global Styles
   =========================== */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --sidebar-width: 250px;
    --header-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* ===========================
   Authentication Pages
   =========================== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.auth-wrapper {
    width: 100%;
    max-width: 450px;
}

.auth-container {
    background: white;
    border-radius: 10px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.auth-header {
    margin-bottom: 30px;
}

.auth-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 10px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--secondary-color);
}

.auth-content .card {
    border: none;
    box-shadow: none;
}

.auth-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Login Form Enhancements */
.input-group-text {
    background-color: var(--light-color);
    border-right: none;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* ===========================
   Main Layout
   =========================== */
.wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    height: var(--header-height);
}

.main-header .navbar {
    height: var(--header-height);
    padding: 0 20px;
}

.main-header .navbar-brand {
    font-size: 20px;
    font-weight: 600;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
    z-index: 1020;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.sidebar-nav .nav-link {
    color: var(--dark-color);
    padding: 12px 20px;
    border-left: 3px solid transparent;
    transition: all 0.3s;
    display: flex;
    align-items: center;
}

.sidebar-nav .nav-link:hover {
    background-color: var(--light-color);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.sidebar-nav .nav-link.active {
    background-color: rgba(13, 110, 253, 0.1);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.sidebar-nav .nav-link i {
    width: 20px;
}

.nav-divider {
    height: 1px;
    background-color: #dee2e6;
    margin: 15px 20px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #dee2e6;
    background-color: var(--light-color);
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1010;
}

/* Main Content */
.main-content {
    margin-top: var(--header-height);
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: calc(100vh - var(--header-height));
    transition: margin-left 0.3s ease;
}

/* Footer */
.main-footer {
    margin-left: var(--sidebar-width);
    padding: 20px 30px;
    background-color: white;
    border-top: 1px solid #dee2e6;
    transition: margin-left 0.3s ease;
}

/* ===========================
   Page Elements
   =========================== */
.page-header {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
}

.page-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 5px;
}

/* Cards */
.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card-header {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    border-radius: 8px 8px 0 0 !important;
}

/* DataTables Customization */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 15px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 5px 10px;
    margin: 0 2px;
    border-radius: 4px;
}

table.dataTable {
    border-collapse: collapse !important;
}

table.dataTable thead th {
    background-color: var(--light-color);
    font-weight: 600;
    border-bottom: 2px solid var(--primary-color);
}

table.dataTable tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Buttons */
.btn {
    border-radius: 6px;
    padding: 8px 16px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

/* Badges */
.badge {
    padding: 5px 10px;
    font-weight: 500;
}

/* Alerts */
.alert {
    border-radius: 6px;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.alert i {
    font-size: 18px;
}

/* Forms */
.form-label {
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--dark-color);
}

.form-control,
.form-select {
    border-radius: 6px;
    border: 1px solid #ced4da;
    padding: 10px 15px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.invalid-feedback {
    display: block;
    margin-top: 5px;
}

/* Stats Cards */
.stats-card {
    border-left: 4px solid var(--primary-color);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.stats-card .stats-icon {
    font-size: 48px;
    opacity: 0.2;
}

.stats-card .stats-number {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stats-card .stats-label {
    font-size: 14px;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Auto-save Indicator */
.auto-save-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--success-color);
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===========================
   Responsive Design
   =========================== */

/* Tablets */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-content,
    .main-footer {
        margin-left: 0;
    }

    body.sidebar-open {
        overflow: hidden;
    }
}

/* Mobile Phones */
@media (max-width: 767px) {
    .main-content {
        padding: 15px;
    }

    .page-title {
        font-size: 22px;
    }

    .auth-container {
        padding: 25px;
    }

    .auth-title {
        font-size: 24px;
    }

    .stats-card .stats-number {
        font-size: 24px;
    }

    .stats-card .stats-icon {
        font-size: 36px;
    }

    /* Stack buttons on mobile */
    .btn-group-mobile {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .btn-group-mobile .btn {
        width: 100%;
    }
}

/* Small Phones */
@media (max-width: 576px) {
    .main-header .navbar-brand {
        font-size: 16px;
    }

    .sidebar {
        width: 80%;
    }

    .auth-wrapper {
        max-width: 100%;
    }

    .auth-container {
        padding: 20px;
    }
}

/* ===========================
   Print Styles
   =========================== */
@media print {
    .sidebar,
    .main-header,
    .main-footer,
    .btn,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
        margin-top: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ===========================
   Utility Classes
   =========================== */
.text-primary { color: var(--primary-color) !important; }
.text-secondary { color: var(--secondary-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-info { color: var(--info-color) !important; }

.bg-primary { background-color: var(--primary-color) !important; }
.bg-secondary { background-color: var(--secondary-color) !important; }
.bg-success { background-color: var(--success-color) !important; }
.bg-danger { background-color: var(--danger-color) !important; }
.bg-warning { background-color: var(--warning-color) !important; }
.bg-info { background-color: var(--info-color) !important; }

.cursor-pointer {
    cursor: pointer;
}

.shadow-sm {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.shadow {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
}

.shadow-lg {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15) !important;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}
