/* Multi-Store Cash IN/OUT Management System - Styles */

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #dee2e6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Header */
.navbar {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem 0;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color) !important;
}

.navbar-nav .nav-link {
    color: #333 !important;
    margin: 0 0.5rem;
    transition: color 0.3s;
}

.navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Cards */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    overflow: hidden;
}

.card-header {
    background-color: var(--primary-color);
    color: #fff;
    padding: 1rem 1.5rem;
    font-weight: bold;
}

.card-body {
    padding: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    background-color: #fff;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-success {
    background-color: var(--success-color);
    color: #fff;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-danger {
    background-color: var(--danger-color);
    color: #fff;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-warning {
    background-color: var(--warning-color);
    color: #333;
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: #fff;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: var(--light-color);
    font-weight: 600;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Badges */
.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
}

@media (max-width: 768px) {
    .badge {
        padding: 0.15rem 0.35rem !important;
        font-size: 0.65rem !important;
        border-radius: 3px;
    }
}

@media (max-width: 480px) {
    .badge {
        padding: 0.1rem 0.3rem !important;
        font-size: 0.6rem !important;
    }
}

.badge-success {
    background-color: var(--success-color);
    color: #fff;
}

.badge-warning {
    background-color: var(--warning-color);
    color: #333;
}

.badge-danger {
    background-color: var(--danger-color);
    color: #fff;
}

.badge-info {
    background-color: var(--info-color);
    color: #fff;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.close {
    font-size: 2rem;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    border: none;
    background: none;
}

.close:hover {
    color: #000;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--primary-color);
}

.pagination .active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* Filters */
.filters {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Side Navigation */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    background-color: #2c3e50;
    color: #fff;
    transition: transform 0.3s ease;
    z-index: 1000;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    background-color: #1a252f;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
    display: block;
}

.sidebar-nav {
    list-style: none;
    padding: 1rem 0;
    flex: 1;
    overflow-y: auto;
    margin-bottom: 0;
}

.sidebar-nav-item {
    margin: 0;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.5rem;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar-nav-link:hover {
    background-color: #34495e;
    color: #fff;
    border-left-color: var(--primary-color);
}

.sidebar-nav-link.active {
    background-color: #34495e;
    color: #fff;
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.sidebar-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: #1a252f;
}

.sidebar-submenu.show {
    max-height: 500px;
    display: block !important;
}

.sidebar-submenu .sidebar-nav-link {
    font-size: 0.875rem;
    padding-left: 2rem;
}

.sidebar-nav-link i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    background-color: #1a252f;
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.sidebar-user-info {
    font-size: 0.875rem;
    color: #bdc3c7;
    margin-bottom: 0.5rem;
}

.sidebar-user-name {
    font-weight: 600;
    color: #fff;
}

/* Main Content Area */
.main-content {
    margin-left: 250px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.top-navbar {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.hamburger-menu {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #333;
    padding: 0.5rem;
}

.top-navbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.top-navbar-user {
    color: #666;
    font-size: 0.875rem;
}

.content-wrapper {
    padding: 2rem;
}

/* Mobile Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 999;
}

/* Table Responsive */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.table-responsive table {
    width: 100%;
    min-width: 800px; /* Minimum width to maintain readability */
}

.table-responsive .scroll-hint {
    display: none;
}

@media (max-width: 768px) {
    .table-responsive .scroll-hint {
        display: block;
    }
}

/* Sticky first column for wide tables - disabled for daily/monthly reports */
/* Note: Sticky columns removed for better mobile scrolling */
.table-responsive:not(.no-sticky-column) table th:first-child,
.table-responsive:not(.no-sticky-column) table td:first-child {
    background-color: #fff;
}

/* Ensure all tables are scrollable on mobile */
@media (max-width: 768px) {
    /* Make sure parent containers allow scrolling */
    .card-body,
    .container,
    .content-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Tables without .table-responsive wrapper */
    .card-body > table.table,
    .container > table.table {
        min-width: 800px;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .hamburger-menu {
        display: block;
    }
    
    .content-wrapper {
        padding: 1rem;
    }
    
    .container {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filters-row {
        grid-template-columns: 1fr;
    }
    
    /* Dashboard - smaller text on mobile */
    .stat-card {
        padding: 0.75rem !important;
    }
    
    .stat-card h3 {
        font-size: 0.7rem !important;
        margin-bottom: 0.25rem !important;
    }
    
    .stat-card .value {
        font-size: 1.25rem !important;
    }
    
    .stats-grid .stat-card .value {
        font-size: 1rem !important;
    }
    
    h1 {
        font-size: 1.25rem !important;
    }
    
    h2 {
        font-size: 1.1rem !important;
    }
    
    h3 {
        font-size: 0.9rem !important;
    }
    
    .card-header {
        font-size: 0.85rem !important;
        padding: 0.75rem 1rem !important;
    }
    
    .card-body {
        padding: 0.75rem !important;
        font-size: 0.85rem !important;
    }
    
    /* All tables - smaller text */
    .table {
        font-size: 0.7rem !important;
    }
    
    .table th,
    .table td {
        font-size: 0.65rem !important;
        padding: 0.4rem 0.3rem !important;
        white-space: nowrap;
    }
    
    .table th {
        font-size: 0.6rem !important;
        font-weight: 600;
    }
    
    /* Tables without .table-responsive need min-width for scrolling */
    .card-body > table.table,
    .container > table.table,
    table.table:not(.table-responsive table) {
        min-width: 800px;
    }
    
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
        border: 1px solid var(--border-color);
        border-radius: 4px;
    }
    
    .table-responsive table {
        font-size: 0.65rem !important;
        min-width: 900px;
        margin-bottom: 0;
        display: table;
    }
    
    .table-responsive th,
    .table-responsive td {
        padding: 0.4rem 0.3rem !important;
        white-space: nowrap;
        font-size: 0.65rem !important;
    }
    
    .table-responsive th {
        font-size: 0.6rem !important;
        font-weight: 600;
    }
    
    /* Sticky first column for tables (except those with no-sticky-column class) */
    .table-responsive:not(.no-sticky-column) table th:first-child,
    .table-responsive:not(.no-sticky-column) table td:first-child {
        position: sticky;
        left: 0;
        z-index: 10;
        background-color: #fff;
    }
    
    .table-responsive:not(.no-sticky-column) thead th:first-child {
        z-index: 11;
        background-color: #fff;
    }
    
    .table-responsive:not(.no-sticky-column) tbody tr:hover td:first-child {
        background-color: #fff;
    }
    
    /* Action buttons - smaller on mobile */
    .btn {
        padding: 0.4rem 0.75rem !important;
        font-size: 0.7rem !important;
    }
    
    .btn-sm {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.65rem !important;
    }
    
    /* Filters - smaller on mobile */
    .filters {
        padding: 0.75rem !important;
    }
    
    .filters-row .form-group {
        margin-bottom: 0.75rem !important;
    }
    
    .form-control,
    .form-select {
        padding: 0.5rem !important;
        font-size: 0.75rem !important;
    }
    
    .form-label {
        font-size: 0.7rem !important;
        margin-bottom: 0.25rem !important;
    }
    
    /* Remove sticky first column for daily/monthly reports */
    .table-responsive.no-sticky-column table th:first-child,
    .table-responsive.no-sticky-column table td:first-child {
        position: static !important;
        box-shadow: none !important;
        background-color: inherit !important;
    }
    
    .table-responsive.no-sticky-column thead th:first-child {
        background-color: var(--light-color) !important;
    }
    
    .table-responsive.no-sticky-column tbody tr:hover td:first-child {
        background-color: #f8f9fa !important;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
        max-width: 100%;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 0.75rem 1rem;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin: 0.25rem 0;
    }
}

@media (max-width: 480px) {
    /* Even smaller text on very small screens */
    .stat-card h3 {
        font-size: 0.65rem !important;
    }
    
    .stat-card .value {
        font-size: 1rem !important;
    }
    
    .stats-grid .stat-card .value {
        font-size: 0.9rem !important;
    }
    
    h1 {
        font-size: 1.1rem !important;
    }
    
    h2 {
        font-size: 1rem !important;
    }
    
    h3 {
        font-size: 0.85rem !important;
    }
    
    .card-header {
        font-size: 0.8rem !important;
        padding: 0.5rem 0.75rem !important;
    }
    
    .card-body {
        padding: 0.5rem !important;
        font-size: 0.8rem !important;
    }
    
    /* Even smaller buttons and filters on very small screens */
    .btn {
        padding: 0.35rem 0.6rem !important;
        font-size: 0.65rem !important;
    }
    
    .btn-sm {
        padding: 0.25rem 0.4rem !important;
        font-size: 0.6rem !important;
    }
    
    .form-control,
    .form-select {
        padding: 0.4rem !important;
        font-size: 0.7rem !important;
    }
    
    .form-label {
        font-size: 0.65rem !important;
    }
    
    .table {
        font-size: 0.6rem !important;
    }
    
    .table th,
    .table td {
        font-size: 0.55rem !important;
        padding: 0.3rem 0.25rem !important;
    }
    
    .table th {
        font-size: 0.5rem !important;
    }
    
    .table-responsive table {
        font-size: 0.6rem !important;
        min-width: 1000px;
    }
    
    .table-responsive th,
    .table-responsive td {
        padding: 0.3rem 0.25rem !important;
        font-size: 0.55rem !important;
    }
    
    .table-responsive th {
        font-size: 0.5rem !important;
    }
    
    .table-responsive .scroll-hint {
        font-size: 0.7rem;
        padding: 0.4rem;
    }
}

/* Custom Tooltip */
.custom-tooltip {
    position: fixed;
    background-color: #333;
    color: #fff;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    z-index: 10000;
    pointer-events: none;
    max-width: 300px;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.custom-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

/* Hide stat labels by default */
.stat-label {
    display: none !important;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: #fff;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

/* Print Styles */
@media print {
    .navbar,
    .btn,
    .filters {
        display: none;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

