/* Global styles for MVIIS Billing System */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
}

* {
    box-sizing: border-box;
}

/* Hide main scrollbar */
html {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

html::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f8fafc;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/static/img/background.png');
    /* Zoom background image to appear larger (scaled up) */
    background-size: 150%;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
}

#appContainer {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#appContainer > .container-fluid {
    flex: 1;
}

.navbar.bg-primary {
    background-color: #FF7733 !important;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.navbar-logo {
    height: 64px; /* increased */
    width: auto;
    display: inline-block;
    object-fit: contain;
    /* Add white background to logo to avoid blending with navbar */
    background-color: #ffffff;
    padding: 6px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

@media (max-width: 992px) {
    .navbar-logo { height: 44px; }
}

/* Loading Overlay */
#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

#loadingOverlay.d-none {
    display: none !important;
}

/* Cards */
.card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
}

.stat-card {
    border-left: 4px solid var(--primary-color);
}

.stat-card.success { border-left-color: var(--success-color); }
.stat-card.warning { border-left-color: var(--warning-color); }
.stat-card.info { border-left-color: var(--info-color); }
.stat-card.danger { border-left-color: var(--danger-color); }

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    border-collapse: separate;
    border-spacing: 0;
}

table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Buttons */
.btn {
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

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

.btn-icon {
    padding: 0.375rem 0.5rem;
}

/* Forms */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.375rem;
}

.required-field::after {
    content: " *";
    color: var(--danger-color);
}

/* Alerts and Badges */
.alert {
    border-radius: 6px;
    border: none;
}

.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    border-radius: 4px;
}

/* Status badges */
.badge-status-planning { background-color: #6c757d; }
.badge-status-in_progress { background-color: #0d6efd; }
.badge-status-on_hold { background-color: #ffc107; color: #000; }
.badge-status-payment_completed { background-color: #20c997; }
.badge-status-completed { background-color: #198754; }
.badge-status-cancelled { background-color: #dc3545; }

/* Document type badges */
.badge-quotation { background-color: #0dcaf0; color: #000; }
.badge-proforma { background-color: #ffc107; color: #000; }
.badge-invoice { background-color: #198754; }

/* GST type badges */
.badge-gst-sez { background-color: #6c757d; }
.badge-gst-igst { background-color: #0d6efd; }
.badge-gst-cgst { background-color: #198754; }

/* Search and filters */
.search-box {
    position: relative;
}

.search-box .form-control {
    padding-left: 2.5rem;
}

.search-box .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

/* Pagination */
.pagination {
    margin-bottom: 0;
}

.pagination .page-link {
    border-radius: 4px;
    margin: 0 2px;
}

/* Modal improvements */
.modal-header {
    border-bottom: 1px solid #e0e0e0;
}

.modal-footer {
    border-top: 1px solid #e0e0e0;
}

/* Line items table */
.line-items-table input,
.line-items-table select {
    min-width: 80px;
}

.line-items-table .item-name { min-width: 200px; }
.line-items-table .item-hsn { min-width: 100px; }
.line-items-table .item-value { min-width: 120px; }
.line-items-table .item-qty { min-width: 80px; }
.line-items-table .item-gst { min-width: 120px; }

/* Action buttons group */
.action-buttons {
    display: flex;
    gap: 0.25rem;
}

.action-buttons .btn {
    padding: 0.25rem 0.5rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Clickable rows */
.clickable-row {
    cursor: pointer;
}

/* Typeahead / Autocomplete */
.typeahead-dropdown {
    position: absolute;
    z-index: 1000;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 250px;
    overflow-y: auto;
    width: 100%;
}

.typeahead-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.typeahead-item:hover,
.typeahead-item.active {
    background-color: #f8f9fa;
}

.typeahead-item:last-child {
    border-bottom: none;
}

/* Currency display */
.currency {
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.currency::before {
    content: "₹";
    margin-right: 2px;
}

/* Toast customization */
.toast {
    min-width: 300px;
}

/* Print styles */
@media print {
    .navbar,
    .footer,
    .btn,
    .no-print {
        display: none !important;
    }

    body {
        font-size: 12pt;
    }

    .card {
        border: 1px solid #000;
        box-shadow: none;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1rem;
    }

    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    .table-responsive {
        font-size: 0.875rem;
    }

    .action-buttons {
        flex-wrap: wrap;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Spin animation for refresh buttons */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

/* Nav link active state */
.nav-link.active {
    font-weight: 600;
}

.dropdown-item.active {
    background-color: var(--primary-color);
    color: white;
}

/* Home Page Navigation Cards */
.home-nav-card {
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
}

.home-nav-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
    border-color: var(--primary-color);
}

.home-nav-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-nav-card .card-title {
    color: #333;
    font-weight: 600;
}

.home-nav-card:hover .card-title {
    color: var(--primary-color);
}
