/* Global Styles */
:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --success-color: #4cc9f0;
    --warning-color: #f72585;
    --danger-color: #e63946;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --gray-color: #6c757d;
    --light-gray: #e9ecef;
    --border-color: #dee2e6;
    --shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --transition: all 0.3s ease;
}

/* Dark Theme Variables */
.dark-theme {
    --primary-color: #4cc9f0;
    --secondary-color: #4895ef;
    --accent-color: #4361ee;
    --light-color: #212529;
    --dark-color: #f8f9fa;
    --gray-color: #adb5bd;
    --light-gray: #343a40;
    --border-color: #495057;
    --shadow: 0 0.125rem 0.25rem rgba(255, 255, 255, 0.075);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--dark-color);
    background-color: var(--light-gray);
    transition: var(--transition);
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}

a:hover {
    color: var(--secondary-color);
}

ul {
    list-style: none;
}

button {
    cursor: pointer;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    transition: var(--transition);
}

input, select, textarea {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    width: 100%;
    background-color: var(--light-color);
    color: var(--dark-color);
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.25);
}

/* Layout */
.container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: var(--dark-color);
    color: var(--light-color);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.top-bar {
    background-color: var(--light-color);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    z-index: 10;
}

.page-content {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

/* Sidebar */
.logo {
    padding: 1rem 0;
    text-align: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-color);
}

.logo h2 {
    color: var(--primary-color);
    font-weight: 700;
}

.main-nav ul li {
    margin-bottom: 0.5rem;
}

.main-nav ul li a {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    color: var(--light-color);
    border-radius: 4px;
    transition: var(--transition);
}

.main-nav ul li a i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

.main-nav ul li a:hover, .main-nav ul li.active a {
    background-color: var(--primary-color);
    color: white;
}

.theme-toggle {
    margin-top: auto;
    padding: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-color);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Top Bar */
.search-container {
    display: flex;
    align-items: center;
    max-width: 300px;
    width: 100%;
}

.search-container input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.search-container button {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 0.75rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
}

.btn-secondary {
    background-color: var(--gray-color);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--dark-color);
}

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

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

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-logout {
    background-color: transparent;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.btn-logout:hover {
    background-color: var(--danger-color);
    color: white;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.75rem;
    color: var(--dark-color);
}

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

.stat-card {
    background-color: var(--light-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.stat-card .icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1.5rem;
}

.stat-card .icon.products {
    background-color: rgba(76, 201, 240, 0.2);
    color: var(--success-color);
}

.stat-card .icon.customers {
    background-color: rgba(67, 97, 238, 0.2);
    color: var(--primary-color);
}

.stat-card .icon.bills {
    background-color: rgba(72, 149, 239, 0.2);
    color: var(--accent-color);
}

.stat-card .icon.revenue {
    background-color: rgba(247, 37, 133, 0.2);
    color: var(--warning-color);
}

.stat-card .stat-info h3 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.stat-card .stat-info p {
    color: var(--gray-color);
    font-size: 0.9rem;
    margin: 0;
}

/* Tables */
.table-container {
    background-color: var(--light-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
    overflow-x: auto;
}

.table-container h2 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

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

.data-table th, .data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: var(--light-gray);
    color: var(--dark-color);
    font-weight: 600;
}

.data-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.data-table .actions {
    display: flex;
    gap: 0.5rem;
}

.data-table .actions button {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background-color: rgba(76, 201, 240, 0.2);
    color: var(--success-color);
}

.badge-warning {
    background-color: rgba(247, 37, 133, 0.2);
    color: var(--warning-color);
}

.badge-danger {
    background-color: rgba(230, 57, 70, 0.2);
    color: var(--danger-color);
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--light-color);
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    animation: modalFadeIn 0.3s;
}

.modal-lg {
    max-width: 800px;
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.close-modal {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-color);
}

.modal-body {
    padding: 1.5rem;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dashboard Specific */
.dashboard-sections {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.recent-bills, .low-stock {
    background-color: var(--light-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.recent-bills h2, .low-stock h2 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

/* Products Page */
.products-container, .customers-container {
    background-color: var(--light-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.filter-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    margin-bottom: 0;
    white-space: nowrap;
}

.filter-group select, .filter-group input {
    width: auto;
}

/* Billing Page */
.billing-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.bill-form-container, .bill-history {
    background-color: var(--light-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.product-selection {
    margin: 1.5rem 0;
}

.product-search-container {
    position: relative;
    margin-bottom: 1rem;
}

.search-results-container {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--light-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: var(--shadow);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.search-result-item {
    padding: 0.5rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.search-result-item:hover {
    background-color: var(--light-gray);
}

.selected-products {
    margin-top: 1rem;
}

.bill-summary {
    background-color: var(--light-gray);
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1.5rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.summary-row.total {
    font-weight: 700;
    font-size: 1.1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

.summary-row input {
    width: 80px;
    text-align: right;
}

/* Reports Page */
.reports-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.report-section {
    background-color: var(--light-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.report-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.report-card {
    background-color: var(--light-gray);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.report-card h3 {
    font-size: 0.9rem;
    color: var(--gray-color);
    margin-bottom: 0.5rem;
}

.report-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.chart-container {
    margin-top: 1.5rem;
}

.chart {
    height: 300px;
    background-color: var(--light-gray);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-placeholder {
    text-align: center;
    color: var(--gray-color);
}

.chart-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.date-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.date-filter input {
    width: auto;
}

.export-section {
    background-color: var(--light-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.export-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Login and Register Pages */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--light-gray);
}

.login-form-container {
    width: 100%;
    max-width: 450px;
    padding: 2rem;
    background-color: var(--light-color);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.btn-block {
    width: 100%;
}

.form-footer {
    margin-top: 1rem;
    text-align: center;
}

.form-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.form-footer a:hover {
    text-decoration: underline;
}

.error-message {
    color: var(--danger-color);
    background-color: rgba(255, 0, 0, 0.1);
    padding: 0.75rem;
    border-radius: 4px;
    margin-top: 1rem;
    display: none;
}

/* Responsive Design */
@media (max-width: 992px) {
    .dashboard-sections {
        grid-template-columns: 1fr;
    }
    
    .billing-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    .logo {
        margin-bottom: 0.5rem;
    }
    
    .main-nav ul {
        display: flex;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .main-nav ul li {
        margin-bottom: 0;
        margin-right: 0.5rem;
    }
    
    .theme-toggle {
        display: none;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .filter-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .date-filter {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 576px) {
    .stat-cards {
        grid-template-columns: 1fr;
    }
    
    .report-cards {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions button {
        width: 100%;
    }
    
    .export-options {
        flex-direction: column;
    }
    
    .export-options button {
        width: 100%;
    }
}