: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 {
    padding: 0;
    margin: 0;
    background-color: #f8fafc;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.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;
}

.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: 65%;
    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;
}

.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: 350px;
}

.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(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.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;
    gap: 1rem;
    margin-bottom: 1.5rem;
    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;
} 

/* Mobile-specific flatpickr styles */
@media (max-width: 768px) {
    .flatpickr-calendar {
        width: 100% !important;
        max-width: 350px;
        margin: 0 auto;
    }

    .flatpickr-current-month {
        font-size: 1.2em !important;
        padding: 10px 0 !important;
    }

    .flatpickr-day {
        height: 40px !important;
        line-height: 40px !important;
        font-size: 1.1em;
    }

    .flatpickr-time {
        height: 50px !important;
        line-height: 50px !important;
    }

    .flatpickr-hour, .flatpickr-minute {
        font-size: 1.1em !important;
        height: 50px !important;
        line-height: 50px !important;
    }

    .form-input[readonly] {
        opacity: 1;
        background-color: #fff;
    }
}

/* Improve touch targets */
.flatpickr-prev-month, .flatpickr-next-month {
    padding: 10px !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
    font-size: 1.1em;
    padding: 5px;
} 

select {
    appearance: none; /* Removes default styling */
    -webkit-appearance: none; /* For Safari */
    -moz-appearance: none; /* For Firefox */
    background-color: white;
    border: 1px solid #ccc;
    padding: 10px;
    font-size: 16px;
    border-radius: 5px;
    width: 100%;
  }
  
  select {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="black"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 15px;
    padding-right: 30px; /* Space for the arrow */
  }
  
  #deliveryTime {
    appearance: none; /* Removes default styling */
    -webkit-appearance: none; /* For Safari */
    -moz-appearance: none; /* For Firefox */
    background-color: white;
    border: 1px solid #ccc;
    padding: 10px;
    font-size: 16px;
    border-radius: 5px;
    width: 100%;

  }
  #deliveryTime {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="black"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 15px;
    padding-right: 30px; /* Space for the arrow */
  }