/*
 * Complete Sales Management CSS
 * All styles in one file - no @import statements
 * This version preserves JavaScript functionality while adding styling
 */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #000000;
    color: #ffffff;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Container Layout */
.container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: linear-gradient(135deg, #f1c40f, #f39c12);
    padding: 1.5rem 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 100;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.logo {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #000000;
    letter-spacing: -1px;
    margin-bottom: 0;
}

.nav-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 1rem;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    position: relative;
    transition: all 0.3s ease;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    text-decoration: none;
    color: #000000;
    width: 100%;
    box-sizing: border-box;
}

.nav-link:hover {
    background-color: rgba(0, 0, 0, 0.1);
    border-left-color: #000000;
    transform: translateX(5px);
    text-decoration: none;
}

.nav-item.active .nav-link {
    background-color: rgba(0, 0, 0, 0.15);
    border-left-color: #000000;
    transform: translateX(5px);
}

.nav-icon {
    font-size: 1rem;
    margin-right: 0.5rem;
    width: 20px;
    text-align: center;
    color: #000000;
    transition: transform 0.15s ease;
}

.nav-text {
    font-size: 1rem;
    font-weight: 500;
    color: #000000;
    transition: color 0.15s ease;
}

.nav-link:hover .nav-icon {
    transform: scale(1.1);
}

.nav-link:focus {
    outline: 2px solid #f1c40f;
    outline-offset: -2px;
    background-color: rgba(0, 0, 0, 0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    background-color: #000000;
    overflow-y: auto;
}

/* Sales Header */
.sales-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title-section h1 {
    font-size: 3rem;
    font-weight: 300;
    color: #ffffff;
    margin-bottom: 0.25rem;
    letter-spacing: -1px;
}

.page-subtitle {
    color: #888888;
    font-size: 1.1rem;
    margin-bottom: 0;
}

.sales-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Sales Statistics */
.sales-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, #1a1a1a, #333333);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #555555;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(255, 255, 255, 0.1);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(135deg, #f1c40f, #f39c12);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #f1c40f;
    display: block;
    line-height: 1;
}

.stat-label {
    font-size: 1rem;
    color: #888888;
    margin-top: 0.25rem;
    font-weight: 500;
}

.stat-change {
    font-size: 0.9rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

.stat-change.positive {
    color: #2ecc71;
}

.stat-change.negative {
    color: #e74c3c;
}

/* Charts */
.sales-charts {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-card {
    background-color: #1a1a1a;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #333333;
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chart-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 255, 255, 0.1);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #333333;
}

.chart-header h3 {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 500;
    margin: 0;
}

.chart-period {
    background-color: #333333;
    border: 1px solid #555555;
    border-radius: 8px;
    padding: 0.25rem 0.5rem;
    color: #ffffff;
    font-size: 0.9rem;
    cursor: pointer;
}

.chart-container {
    position: relative;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000000;
    border-radius: 8px;
    overflow: hidden;
}

canvas {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    transition: transform 0.3s ease;
}

canvas:hover {
    transform: scale(1.01);
}

/* Controls */
.sales-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: #1a1a1a;
    border-radius: 12px;
    border: 1px solid #333333;
}

.search-container {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-box {
    background-color: #333333;
    border: 1px solid #555555;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    color: #ffffff;
    font-size: 1rem;
    width: 100%;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-box:focus {
    outline: none;
    border-color: #f1c40f;
    box-shadow: 0 0 0 3px rgba(241, 196, 15, 0.1);
}

.search-box::placeholder {
    color: #888888;
}

.filter-select {
    background-color: #333333;
    border: 1px solid #555555;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    color: #ffffff;
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.15s ease;
    min-width: 150px;
}

.filter-select:focus {
    outline: none;
    border-color: #f1c40f;
}

.filter-select option {
    background-color: #333333;
    color: #ffffff;
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, #f1c40f, #f39c12);
    color: #000000;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(241, 196, 15, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #333333;
    color: #ffffff;
}

.btn-secondary:hover {
    background: #555555;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.btn-icon {
    font-size: 1rem;
}

/* Sales Table */
.sales-table-container {
    background-color: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #333333;
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.05);
    margin-bottom: 2rem;
}

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

.sales-table th,
.sales-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #333333;
}

.sales-table th {
    background-color: #333333;
    font-weight: 500;
    color: #ffffff;
    font-size: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sales-table td {
    color: #ffffff;
    font-size: 1rem;
    vertical-align: middle;
}

.sales-table tbody tr {
    transition: background-color 0.15s ease;
}

.sales-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.sales-table tbody tr:last-child td {
    border-bottom: none;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 1.5rem 0;
}

/* Status and Payment Badges */
.sale-status,
.payment-method {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    min-width: 80px;
}

/* Status Colors */
.sale-status.completed {
    background-color: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.sale-status.pending {
    background-color: rgba(243, 156, 18, 0.2);
    color: #f39c12;
    border: 1px solid rgba(243, 156, 18, 0.3);
}

.sale-status.processing {
    background-color: rgba(52, 152, 219, 0.2);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.sale-status.cancelled {
    background-color: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

/* Payment Method Colors */
.payment-method.cash {
    background-color: rgba(39, 174, 96, 0.2);
    color: #27ae60;
    border: 1px solid rgba(39, 174, 96, 0.3);
}

.payment-method.credit_card,
.payment-method.debit_card {
    background-color: rgba(52, 152, 219, 0.2);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.payment-method.bank_transfer {
    background-color: rgba(155, 89, 182, 0.2);
    color: #9b59b6;
    border: 1px solid rgba(155, 89, 182, 0.3);
}

.payment-method.paypal {
    background-color: rgba(243, 156, 18, 0.2);
    color: #f39c12;
    border: 1px solid rgba(243, 156, 18, 0.3);
}

/* Modals */
.modal {
    display: none;
    /* This is critical - modals should be hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.modal.active {
    display: flex;
    /* Only show when active class is added */
}

.modal-content {
    background-color: #1a1a1a;
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 700px;
    border: 1px solid #555555;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #333333;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 500;
    color: #ffffff;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: #888888;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.15s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.close-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Form Styles */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.form-label {
    display: block;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.form-input {
    width: 100%;
    background-color: #333333;
    border: 1px solid #555555;
    border-radius: 8px;
    padding: 0.5rem;
    color: #ffffff;
    font-size: 1rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus {
    outline: none;
    border-color: #f1c40f;
    box-shadow: 0 0 0 3px rgba(241, 196, 15, 0.1);
}

.form-input option {
    background-color: #333333;
    color: #ffffff;
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

/* Products Section */
.products-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: 1px solid #333333;
    border-radius: 8px;
    background-color: #000000;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.products-header h4 {
    color: #ffffff;
    margin: 0;
}

.sale-product-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    border: 1px solid #333333;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background-color: #1a1a1a;
    transition: all 0.15s ease;
}

.sale-product-item:hover {
    border-color: #555555;
    transform: translateY(-1px);
}

.sale-product-item:last-child {
    margin-bottom: 0;
}

.product-info-mini {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-name-mini {
    color: #ffffff;
    font-weight: 500;
    font-size: 1rem;
    margin-bottom: 2px;
}

.product-price-mini {
    color: #888888;
    font-size: 0.9rem;
}

.quantity-input {
    width: 80px;
    background-color: #333333;
    border: 1px solid #555555;
    border-radius: 4px;
    padding: 0.25rem;
    color: #ffffff;
    text-align: center;
    font-size: 1rem;
    transition: border-color 0.15s ease;
}

.quantity-input:focus {
    outline: none;
    border-color: #f1c40f;
}

.remove-product-btn {
    background-color: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 4px;
    padding: 0.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.9rem;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-product-btn:hover {
    background-color: rgba(231, 76, 60, 0.3);
    transform: scale(1.1);
}

/* Totals Section */
.totals-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: 1px solid #333333;
    border-radius: 8px;
    background-color: #000000;
}

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

.total-row:last-child {
    margin-bottom: 0;
}

.total-final {
    font-size: 1.2rem;
    font-weight: 700;
    padding-top: 0.5rem;
    border-top: 1px solid #333333;
    color: #f1c40f;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #333333;
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-body p {
    color: #ffffff;
    margin-bottom: 0;
    line-height: 1.6;
}

/* Product Selection Modal */
.product-search {
    margin-bottom: 1rem;
}

.products-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #333333;
    border-radius: 8px;
    background-color: #000000;
}

.product-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #333333;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.product-option:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.product-option:last-child {
    border-bottom: none;
}

.product-option-info {
    display: flex;
    flex-direction: column;
}

.product-option-name {
    color: #ffffff;
    font-weight: 500;
    margin-bottom: 2px;
}

.product-option-details {
    color: #888888;
    font-size: 0.9rem;
}

.product-option-price {
    color: #f1c40f;
    font-weight: 700;
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sales-charts {
        grid-template-columns: 1fr;
    }

    .sales-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        overflow-x: auto;
        padding: 1rem 0;
    }

    .nav-menu {
        display: flex;
        white-space: nowrap;
        padding: 0 1rem;
        gap: 0.25rem;
    }

    .nav-item {
        flex-direction: column;
        padding: 0.5rem;
        min-width: 80px;
        text-align: center;
        border-left: none;
        border-bottom: 4px solid transparent;
    }

    .nav-item:hover,
    .nav-item.active {
        border-left: none;
        border-bottom-color: #000000;
        transform: translateY(-3px);
    }

    .nav-icon {
        margin-right: 0;
        margin-bottom: 0.25rem;
    }

    .nav-text {
        font-size: 0.9rem;
    }

    .main-content {
        padding: 1rem;
    }

    .sales-header {
        flex-direction: column;
        align-items: stretch;
    }

    .sales-actions {
        justify-content: stretch;
    }

    .sales-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .sales-stats {
        grid-template-columns: 1fr;
    }

    .sales-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-container {
        min-width: auto;
    }

    .filter-select {
        min-width: auto;
    }

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

    .sales-table {
        min-width: 800px;
    }

    .page-title-section h1 {
        font-size: 2rem;
    }

    .chart-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .chart-period {
        width: 100%;
    }
}