/* ===== BASE STYLES ===== */
:root {
    --primary: #007bff;
    --secondary: #6c757d;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #343a40;
    --purple: #6f42c1;
    --pink: #e83e8c;
    --teal: #20c997;
    --cyan: #00c9ff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

/* ===== TOP BAR ===== */
.top-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.top-bar h2 {
    margin: 0;
    font-size: 1.8em;
    font-weight: 600;
}

.nav-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-blue {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
}

.btn-green {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
}

.btn-red {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.btn-yellow {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #212529;
}

.btn-purple {
    background: linear-gradient(135deg, #6f42c1 0%, #5a32a3 100%);
    color: white;
}

.btn-cyan {
    background: linear-gradient(135deg, #17a2b8 0%, #117a8b 100%);
    color: white;
}

.btn-orange {
    background: linear-gradient(135deg, #fd7e14 0%, #e8590c 100%);
    color: white;
}

.btn-gray {
    background: linear-gradient(135deg, #6c757d 0%, #545b62 100%);
    color: white;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn.active {
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
    transform: translateY(0);
}

/* ===== FORMS ===== */
.form-container {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin: 20px auto;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    max-width: 1200px;
    border-top: 5px solid;
}

.form-container h3 {
    margin-top: 0;
    color: #333;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 20px;
}

.pur-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    background: #f8f9fa;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    outline: none;
    background: white;
}

/* ===== TABLES ===== */
.table-container {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin: 20px auto;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    max-width: 1200px;
    overflow-x: auto;
}

.table-container h2 {
    margin-top: 0;
    color: #333;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 20px;
}

table.dataTable {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
}

table.dataTable thead th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #333;
    font-weight: 600;
    padding: 15px;
    border-bottom: 2px solid #dee2e6;
}

table.dataTable tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

table.dataTable tbody tr:hover {
    background-color: #f8f9fa;
}

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
    max-width: 1200px;
}

.stat-card {
    text-align: center;
    border-top: 4px solid;
}

.stat-value {
    font-size: 2.5em;
    font-weight: 700;
    margin: 10px 0;
}

/* ===== ALERTS ===== */
.alert-box {
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px auto;
    max-width: 1200px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert-box.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-box.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-box.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* ===== MODALS ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-title {
    font-size: 1.5em;
    color: #333;
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    line-height: 1;
}

.close-modal:hover {
    color: #333;
}

/* ===== LOADING ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== FILTERS ===== */
.filter-bar {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin: 20px auto;
    max-width: 1200px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.filter-bar input,
.filter-bar select {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    min-width: 200px;
}

/* ===== FOOTER ===== */
.footer {
    background: linear-gradient(135deg, #343a40 0%, #212529 100%);
    color: white;
    padding: 40px 20px 20px;
    margin-top: 50px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-section h4 {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: #f8f9fa;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section ul li a {
    color: #adb5bd;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section ul li a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    margin-top: 40px;
    border-top: 1px solid #495057;
    color: #adb5bd;
    font-size: 14px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .top-bar {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .nav-links {
        width: 100%;
        justify-content: center;
    }
    
    .pur-grid {
        grid-template-columns: 1fr;
    }
    
    .form-container,
    .table-container,
    .alert-box {
        margin: 10px;
        padding: 15px;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-bar input,
    .filter-bar select {
        width: 100%;
    }
}

/* ===== UTILITY CLASSES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-0 { margin-top: 0; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }

.mb-0 { margin-bottom: 0; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

.p-0 { padding: 0; }
.p-10 { padding: 10px; }
.p-20 { padding: 20px; }
.p-30 { padding: 30px; }

.hidden { display: none; }
.flex { display: flex; }
.grid { display: grid; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-around {
    display: flex;
    align-items: center;
    justify-content: space-around;
}

.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }
.gap-30 { gap: 30px; }

/* ===== PRINT STYLES ===== */
@media print {
    .top-bar,
    .footer,
    .btn,
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .table-container {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
    
    table {
        width: 100% !important;
        border-collapse: collapse !important;
    }
    
    table, th, td {
        border: 1px solid black !important;
    }
}
/* ===== SALES HISTORY TABLE STYLES ===== */

/* ცხრილის კონტეინერი */
#salesHistoryTable_wrapper {
    margin: 20px 0;
}

/* მთავარი ცხრილი */
#salesHistoryTable {
    width: 100% !important;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 14px;
}

/* თავსართი */
#salesHistoryTable thead tr {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #dee2e6;
    height: 50px;
}

#salesHistoryTable thead th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    position: relative;
    white-space: nowrap;
}

/* Checkbox სვეტი */
#salesHistoryTable th.checkbox-column {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    text-align: center;
    padding: 12px 5px !important;
}

#salesHistoryTable td.checkbox-column {
    text-align: center;
    padding: 12px 5px !important;
}

/* Checkbox ელემენტები */
#salesHistoryTable input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin: 0;
    accent-color: #007bff; /* თანამედროვე ბრაუზერებისთვის */
}

#selectAllHeader {
    transform: scale(1.2); /* ოდნავ დიდი */
    margin-top: 2px;
}

/* DataTables კლასები */
#salesHistoryTable.display {
    clear: both;
    margin-top: 6px !important;
    margin-bottom: 6px !important;
    max-width: none !important;
}

#salesHistoryTable.compact th,
#salesHistoryTable.compact td {
    padding: 8px 12px; /* ნაკლები padding კომპაქტურისთვის */
}

/* მწკრივები */
#salesHistoryTable tbody tr {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

#salesHistoryTable tbody tr:hover {
    background-color: #f8f9fa;
}

/* უჯრები */
#salesHistoryTable tbody td {
    padding: 12px 15px;
    vertical-align: middle;
    border-bottom: 1px solid #eee;
    color: #555;
}

/* რესპონსიულობა */
@media (max-width: 768px) {
    #salesHistoryTable {
        font-size: 13px;
    }
    
    #salesHistoryTable th,
    #salesHistoryTable td {
        padding: 8px 10px;
    }
    
    #salesHistoryTable th.checkbox-column,
    #salesHistoryTable td.checkbox-column {
        width: 30px;
        min-width: 30px;
        max-width: 30px;
        padding: 8px 3px !important;
    }
}