:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --danger-color: #dc2626;
    --danger-hover: #b91c1c;
    --success-color: #16a34a;
    --success-hover: #15803d;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --border-color: #e5e7eb;
    --bg-hover: #f3f4f6;
}

body {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    background-color: #f8fafc;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    overflow-x: hidden;
}

.container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

.logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    display: block;
    transition: transform 0.2s;
}

.logo:hover {
    transform: scale(1.05);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-secondary);
    text-align: center;
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

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

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s;
    background: white;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
    color: #9ca3af;
}

.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s;
    background: white;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea::placeholder {
    color: #9ca3af;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
    gap: 0.5rem;
    border: none;
}

.btn-icon {
    width: 1rem;
    height: 1rem;
}

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

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

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

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

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

.btn-success:hover {
    background: var(--success-hover);
}

.btn-block {
    width: 100%;
}

.grid {
    display: grid;
    gap: 0.5rem;
}

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

.product-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    background: #f9fafb;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.price-display,
.total-price {
    min-width: 80px;
    padding: 0.75rem;
    text-align: right;
    font-weight: 500;
    color: var(--text-primary);
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.total-price {
    color: var(--primary-color);
}

.product-select {
    flex-grow: 1;
    position: relative;
}

.select-wrapper {
    position: relative;
    flex-grow: 1;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s;
    background: white;
    box-sizing: border-box;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.products-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    display: none;
}

.products-dropdown.show {
    display: block;
    width: 100%;
    min-width: 250px;
}

.product-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.product-option:hover {
    background: var(--bg-hover);
}

.product-option.selected {
    background: var(--primary-color);
    color: white;
}

.search-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    color: var(--text-secondary);
    pointer-events: none;
}

.product-qty {
    width: 5rem;
}

.remove-btn {
    padding: 0.5rem;
    color: var(--danger-color);
    border-radius: 6px;
    transition: all 0.2s;
}

.remove-btn:hover {
    background: #fee2e2;
}

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

.products-container {
    margin-bottom: 1rem;
}

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

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

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

/* Loading state */
.btn-loading {
    position: relative;
    color: transparent;
}

/* Disabled button state */
.btn[disabled] {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loading::after {
    content: "";
    position: absolute;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Custom Checkbox */
.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 35px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 0.875rem;
    user-select: none;
    color: var(--text-primary);
    padding-top: 10px;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 10px;
    left: 0;
    height: 22px;
    width: 22px;
    background-color: #fff;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    transition: all 0.2s;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--primary-color);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 7px;
    top: 3px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

/* Sales Page Styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 400px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
}

.stat-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.filters {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    align-items: stretch;
}

@media (min-width: 500px) {
    .filters {
        flex-direction: row;
        align-items: center;
    }
}

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

.table-container {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

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

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

.sales-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: #f9fafb;
}

.sales-table tr:hover {
    background: #f9fafb;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-delivering {
    background: #dbeafe;
    color: #1d4ed8;
}
.status-delivered {
    background: #d1fae5;
    color: #047857;
}

.status-packaging {
    background: #fef3c7;
    color: #b45309;
}

.status-packaged {
    background: #d1fae5;
    color: #047857;
}

.status-cancelled {
    background: #fee2e2;
    color: #b91c1c;
}

/* Alert/Error styles */
#error-div {
    margin-top: 0.5rem;
    background-color: var(--danger-color);
    color: white;
    font-size: 0.875rem;
    padding: 1rem;
    border-radius: 0.5rem;
    display: none;
    animation: fadeIn 0.3s ease-out;
}

#error-div:not(:empty) {
    display: block;
    margin-bottom: 1rem;
}

#error-div[aria-hidden="true"] {
    display: none;
} 
/* Alert/Success styles */
#success-div {
    margin-top: 0.5rem;
    background-color: var(--success-color);
    color: white;
    font-size: 0.875rem;
    padding: 1rem;
    border-radius: 0.5rem;
    display: none;
    animation: fadeIn 0.3s ease-out;
}

#success-div:not(:empty) {
    display: block;
    margin-bottom: 1rem;
}

#success-div[aria-hidden="true"] {
    display: none;
} 

.refund-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    margin-left: 8px;
    border-radius: 4px;
    color: #ef4444;
    transition: all 0.2s;
}

.refund-btn:hover {
    background-color: #fee2e2;
}

.refund-btn .btn-icon {
    width: 20px;
    height: 20px;
}

/* Additional sidebar-specific styles */
.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-copy {
    background: #06b6d4;
    color: white;
}

.btn-copy:hover {
    background: #0891b2;
}

/* Responsive grid adjustments */
@media (max-width: 400px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .product-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Table responsiveness */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

@media (max-width: 400px) {
    .sales-table th,
    .sales-table td {
        padding: 0.5rem;
        font-size: 0.75rem;
    }
}

/* Sidebar specific adjustments */
.sidebar-container * {
    box-sizing: border-box;
}

/* Product row responsive layout */
.product-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

/* Responsive adjustments for very narrow screens */
@media (max-width: 300px) {
    .product-row {
        gap: 6px !important;
    }
    
    .product-row input[type="number"] {
        width: 50px !important;
    }
    
    /* Stack second line vertically on very narrow screens */
    .product-row > div:last-child {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: auto auto !important;
        gap: 6px !important;
    }
}

/* Product dropdown improvements */
.products-dropdown {
    border: 1px solid #d1d5db !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    max-height: 300px !important;
}

.products-dropdown::-webkit-scrollbar {
    width: 6px;
}

.products-dropdown::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.products-dropdown::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.products-dropdown::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Product option hover effects */
.products-dropdown > div:hover {
    background-color: #f8fafc !important;
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

.products-dropdown > div:last-child {
    border-bottom: none !important;
}

/* Order Cards Styles */
.order-card {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.order-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.order-id {
    color: #3b82f6;
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    cursor: pointer;
}

.order-id:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.order-date {
    color: #64748b;
    font-size: 12px;
}

.order-status-badges {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.delivery-status-pending {
    background: #fef3c7;
    color: #92400e;
}

.delivery-status-packaging {
    background: #fed7d7;
    color: #c53030;
}

.delivery-status-packaged {
    background: #c6f6d5;
    color: #22543d;
}

.delivery-status-delivering {
    background: #bee3f8;
    color: #1a365d;
}

.delivery-status-delivered {
    background: #c6f6d5;
    color: #22543d;
}

.payment-status-paid {
    background: #c6f6d5;
    color: #22543d;
}

.payment-status-unpaid {
    background: #fed7d7;
    color: #c53030;
}

.payment-status-partial {
    background: #fef3c7;
    color: #92400e;
}

.order-client-info {
    margin-bottom: 16px;
}

.client-name {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.client-phone {
    color: #64748b;
    font-size: 14px;
}

.order-type {
    color: #64748b;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 500;
    margin-bottom: 12px;
}

.order-financial {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.total-amount {
    color: #059669;
    font-weight: 700;
    font-size: 16px;
}

.prepayment-info {
    text-align: right;
}

.prepayment-amount {
    color: #3b82f6;
    font-weight: 600;
    font-size: 14px;
}

.debt-amount {
    color: #dc2626;
    font-weight: 600;
    font-size: 12px;
}

.order-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.btn-edit {
    background: #f59e0b;
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-edit:hover {
    background: #d97706;
}

.btn-cancel-order {
    background: #ef4444;
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel-order:hover {
    background: #dc2626;
}

/* Responsive order cards */
@media (min-width: 768px) {
    #ordersCardsContainer {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    }
}

@media (max-width: 767px) {
    .order-card {
        padding: 16px;
    }
    
    .order-financial {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .prepayment-info {
        text-align: left;
        width: 100%;
    }
    
    .order-actions {
        justify-content: stretch;
    }
    
    .btn-edit,
    .btn-cancel-order {
        flex: 1;
        text-align: center;
    }
}

/* Edit form totals responsive grid */
.edit-totals-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: 30% 30% 1fr;
    align-items: start;
}

@media (max-width: 768px) {
    .edit-totals-grid {
        grid-template-columns: 50% 50%;
        grid-template-rows: auto auto;
    }
    
    .edit-bnpl-card {
        grid-column: 1 / -1;
        margin-top: 8px;
    }
}

@media (max-width: 480px) {
    .edit-totals-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .edit-subtotal-card,
    .edit-total-card,
    .edit-bnpl-card {
        grid-column: 1;
    }
}

/* Orders filters responsive layout */
.orders-filters {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.filters-main-row {
    display: grid;
    gap: 12px;
    grid-template-columns: 200px 200px 1fr;
    align-items: center;
}

.filters-actions-row {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
}

.filters-actions-row .btn {
    min-width: 120px;
}

/* Tablet and smaller screens */
@media (max-width: 768px) {
    .filters-main-row {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        gap: 12px;
    }
    
    .filters-main-row #saleId {
        grid-column: 1 / -1;
    }
    
    .filters-actions-row {
        justify-content: stretch;
    }
    
    .filters-actions-row .btn {
        flex: 1;
        min-width: auto;
    }
}

/* Mobile screens */
@media (max-width: 480px) {
    .filters-main-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .filters-main-row #fromDate,
    .filters-main-row #toDate,
    .filters-main-row #saleId {
        grid-column: 1;
    }
    
    .filters-actions-row {
        flex-direction: column;
        gap: 8px;
    }
} 