/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Lazy Loading Styles */
.lazy-image {
    position: relative;
    background-color: #f0f0f0;
    background-size: cover;
    background-position: center;
    transition: opacity 0.3s ease;
}

.lazy-image .placeholder-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #999;
}

.lazy-image.loaded {
    opacity: 1;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 10px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.login-box h1 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 24px;
}

.login-box h2 {
    color: #666;
    margin-bottom: 30px;
    font-size: 18px;
}

/* Admin Layout */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    background: #34495e;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h3 {
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 14px;
    opacity: 0.8;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: block;
    padding: 12px 20px;
    color: white;
    text-decoration: none;
    transition: background 0.3s;
}

.sidebar-menu a:hover {
    background: rgba(255,255,255,0.1);
}

.sidebar-menu a.active {
    background: #3498db;
    border-left: 3px solid white;
}

.admin-content {
    margin-left: 250px;
    padding: 30px;
    width: 100%;
}

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

.content-header h1 {
    font-size: 28px;
    color: #2c3e50;
}

/* Sales Dashboard */
.sales-wrapper {
    min-height: 100vh;
    background: #f8f9fa;
}

.sales-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.sales-header h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

.sales-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
}

.step-content {
    display: none;
    animation: fadeIn 0.3s;
}

.step-content.active {
    display: block;
}

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

/* Cards and Grids */
.card {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    color: #666;
    font-size: 14px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.stat-number {
    font-size: 36px;
    font-weight: bold;
    color: #3498db;
}

.categories-grid,
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.category-card,
.product-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.category-card:hover,
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.category-card img,
.product-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}

.product-card .price {
    font-size: 20px;
    color: #27ae60;
    font-weight: bold;
    margin: 10px 0;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #999;
    font-size: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-actions {
    margin-top: 30px;
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-large {
    padding: 15px 30px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
    text-align: center;
}

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

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

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.data-table tr:hover {
    background: #f8f9fa;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-active,
.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-inactive,
.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-pending {
    background: #cce5ff;
    color: #004085;
}

.badge-completed {
    background: #d4edda;
    color: #155724;
}

.badge-failed {
    background: #f8d7da;
    color: #721c24;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fff;
    margin: 2% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.modal-header {
    padding: 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover,
.close:focus {
    color: #000;
}

.modal-body {
    padding: 30px;
}

/* Product Image */
.product-image-container {
    text-align: center;
    margin-bottom: 20px;
}

.product-thumbnail {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.no-image {
    padding: 60px;
    background-color: #f8f9fa;
    border-radius: 8px;
    color: #6c757d;
    text-align: center;
}

/* Product Description */
.product-description {
    margin-bottom: 25px;
    color: #666;
    line-height: 1.6;
}

/* Variations Section */
.variation-section {
    margin-bottom: 25px;
}

.variations-container h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
}

.variation-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
    cursor: pointer;
    transition: border-color 0.3s;
}

.variation-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

/* Price Section */
.price-quantity-section {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.price-display {
    font-size: 1.8rem;
    font-weight: bold;
    color: #28a745;
    padding: 10px 0;
}

.quantity-input,
.custom-price-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.quantity-input:focus,
.custom-price-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

/* Price Preview */
.price-preview {
    margin-top: 20px;
    padding: 15px;
    background-color: #fff;
    border: 2px solid #007bff;
    border-radius: 6px;
}

.price-breakdown p {
    margin: 8px 0;
    font-size: 14px;
    color: #666;
}

.price-breakdown .total {
    font-size: 18px;
    color: #333;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px solid #dee2e6;
}

/* Select Button */
.btn-select-product {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    font-weight: 600;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-select-product:hover {
    background-color: #0056b3;
}

.btn-select-product:active {
    transform: translateY(1px);
}

/* Selected Product Display */
.selected-product-container {
    margin-top: 20px;
}

.selected-product {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #28a745;
}

.product-info-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.product-thumb-small {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.product-info-header h4 {
    margin: 0;
    color: #333;
    font-size: 1.2rem;
}

.pricing-details {
    margin-top: 15px;
}

.pricing-details p {
    margin: 8px 0;
    color: #666;
}

.custom-price-note {
    color: #007bff;
    font-style: italic;
}

.total-price {
    font-size: 1.3rem;
    color: #28a745 !important;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px solid #dee2e6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-header h2 {
        font-size: 1.2rem;
    }
    
    .product-thumb-small {
        width: 50px;
        height: 50px;
    }
}



/* Secret Key Cell */
.secret-key-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.secret-hidden,
.secret-visible {
    font-family: monospace;
}

/* Order Summary */
.order-summary {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.selected-product {
    background: white;
    padding: 15px;
    border-radius: 4px;
    margin-top: 10px;
}

/* Authorization Section */
.authorization-section {
    background: #fff3cd;
    padding: 20px;
    border-radius: 8px;
    margin-top: 30px;
    border: 1px solid #ffc107;
}

.authorization-section h3 {
    color: #856404;
    margin-bottom: 15px;
}

/* Result Success */
.result-success {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 8px;
}

.result-success h2 {
    color: #27ae60;
    margin-bottom: 30px;
}

.checkout-url {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.checkout-url input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

/* Price Section */
.price-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.price-display {
    font-size: 24px;
    font-weight: bold;
    color: #27ae60;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* No Image Placeholder */
.no-image {
    width: 100%;
    height: 150px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    border-radius: 4px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .admin-sidebar {
        width: 200px;
    }
    
    .admin-content {
        margin-left: 200px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .categories-grid,
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 576px) {
    .admin-sidebar {
        display: none;
    }
    
    .admin-content {
        margin-left: 0;
        padding: 15px;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px auto;
    }
}
 .iti {
    width: 100%;
    display: block;
    position: relative; /* CRITICAL: Allows dropdown to position absolutely */
}

/* Flag container */
.iti__flag-container {
    padding: 0;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
}

/* Selected flag button */
.iti__selected-flag {
    padding: 0 8px 0 8px;
    display: flex;
    align-items: center;
    height: 100%;
    cursor: pointer;
    border-right: 1px solid #ddd;
}

.iti__selected-flag:hover {
    background-color: #f5f5f5;
}

/* Phone input field */
#phone {
    width: 100% !important;
    
    box-sizing: border-box;
}

/* CRITICAL: Country dropdown list */
.iti__country-list {
    position: absolute !important; /* MUST be absolute */
    z-index: 9999 !important; /* Above everything */
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 200px;
    overflow-y: scroll;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    width: 300px; /* Fixed width for dropdown */
    top: 100%; /* Position below the input */
    left: 0;
    margin-top: 2px;
}

/* Hide dropdown by default */
.iti__country-list.iti__hide {
    display: none !important;
}

/* Show dropdown when open */
.iti__country-list:not(.iti__hide) {
    display: block !important;
}

/* Individual country items */
.iti__country {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.iti__country:hover {
    background-color: #f5f5f5;
}

.iti__country.iti__active {
    background-color: #e8f4f8;
}

.iti__country.iti__highlight {
    background-color: #f0f0f0;
}

/* Preferred countries section */
.iti__country.iti__preferred {
    background-color: #fafafa;
}

/* Divider between preferred and all countries */
.iti__divider {
    padding: 0;
    margin: 0;
    border-bottom: 1px solid #ddd;
    height: 1px;
    background: #ddd;
}

/* Flag icon */
.iti__flag {
    width: 20px;
    height: 15px;
    background-image: url('https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.2.1/img/flags.png');
    background-repeat: no-repeat;
    background-size: 5652px 15px;
}

.iti__flag-box {
    margin-right: 8px;
    display: inline-block;
}

/* Country name */
.iti__country-name {
    flex: 1;
    margin-right: 8px;
    color: #333;
}

/* Dial code */
.iti__dial-code {
    color: #999;
    font-size: 14px;
}

.iti__selected-dial-code {
    margin-left: 4px;
    font-size: 14px;
}

/* Arrow icon */
.iti__arrow {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid #555;
    margin-left: 6px;
}

/* Arrow when dropdown is open */
.iti__selected-flag[aria-expanded="true"] .iti__arrow {
    border-top: none;
    border-bottom: 4px solid #555;
}

/* Phone error message */
.phone-error {
    color: #d32f2f;
    font-size: 13px;
    margin-top: 5px;
    display: none;
}

/* Fix for form-group if you have custom styles */
.form-group {
    position: relative;
    margin-bottom: 20px;
}

/* Scrollbar styling for country list */
.iti__country-list::-webkit-scrollbar {
    width: 8px;
}

.iti__country-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.iti__country-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.iti__country-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .iti__country-list {
        width: 100%;
        max-width: calc(100vw - 40px);
    }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .iti__flag {
        background-image: url('https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.2.1/img/flags@2x.png');
    }
}

.strikethrough {
    text-decoration: line-through;
    color: #999;
    opacity: 0.7;
}

.highlight {
    color: #28a745;
    font-weight: bold;
}

.old-price, .old-total {
    color: #666;
}

.new-price, .new-total {
    color: #28a745;
    font-weight: 600;
}

.savings, .savings-note {
    color: #dc3545;
    font-weight: 600;
    font-style: italic;
}

.total-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px solid #dee2e6;
}