:root {
    --primary: #00a651;
    --primary-dark: #006837;
    --primary-light: #22c55e;
    --secondary: #3399ff;
    --accent: #fbbf24;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;

    --background: #ffffff;
    --background-secondary: #f8fafc;
    --background-tertiary: #f1f5f9;
    --card-background: rgba(255, 255, 255, 0.9);

    --text: #1f2937;
    --text-muted: #6b7280;
    --text-secondary: #9ca3af;

    --border: #e5e7eb;
    --border-light: #f3f4f6;

    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-backdrop: blur(20px);

    --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.2);
    --shadow-primary: 0 8px 25px rgba(0, 166, 81, 0.3);

    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;

    --transition: 0.3s ease;
    --transition-slow: 0.5s ease;

    --primary-gradient: linear-gradient(135deg, var(--primary), var(--primary-light));
    --secondary-gradient: linear-gradient(135deg, var(--secondary), #60a5fa);
    --accent-gradient: linear-gradient(135deg, var(--accent), #f59e0b);
}

body.dark-theme {
    --background: #000000;
    --background-secondary: #111111;
    --background-tertiary: #1a1a1a;
    --card-background: rgba(26, 26, 26, 0.9);

    --text: #ffffff;
    --text-muted: #cccccc;
    --text-secondary: #999999;

    --border: #333333;
    --border-light: #404040;

    --glass-bg: rgba(26, 26, 26, 0.9);
    --glass-border: rgba(255, 255, 255, 0.1);

    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    background: linear-gradient(135deg, var(--background) 0%, var(--background-secondary) 50%, var(--background) 100%);
    color: var(--text);
    line-height: 1.6;
    direction: rtl;
    overflow-x: hidden;
    transition: var(--transition);
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 20%, rgba(0, 166, 81, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(51, 153, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(255, 215, 0, 0.05) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 3rem 2rem;
    background: var(--card-background);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    margin-top: 2rem;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-gradient);
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.logo i {
    font-size: 3.5rem;
    color: var(--primary);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.logo h1 {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.3rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.header-features {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.feature-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--background-tertiary);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    border: 1px solid var(--border);
}

.feature-badge i {
    color: var(--primary);
}

.auto-save-info {
    background: linear-gradient(135deg, rgba(0, 166, 81, 0.1), rgba(34, 197, 94, 0.1));
    border: 2px solid var(--primary);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--primary);
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    animation: fadeIn 0.5s ease-in-out;
}

.auto-save-info i {
    font-size: 1.5rem;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.store-form {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    margin-bottom: 3rem;
}

.form-section {
    background: var(--card-background);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.form-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-gradient);
}

.form-section:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.section-header {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-light);
}

.section-header i {
    font-size: 2rem;
    color: var(--primary);
    margin-top: 0.25rem;
}

.section-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.section-description {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.5;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.content-editor {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-group label {
    font-weight: 600;
    color: var(--text);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group label i {
    color: var(--primary);
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 1rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--background);
    color: var(--text);
    font-family: inherit;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.1);
}

.form-group textarea {
    min-height: 120px;
    line-height: 1.6;
}

.input-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: -0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.input-hint::before {
    content: '💡';
}

.shipping-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.add-shipping-btn,
.bulk-add-btn,
.clear-all-btn,
.reset-data-btn {
    border: none;
    padding: 0.875rem 1.75rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    color: white;
}

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

.add-shipping-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
}

.bulk-add-btn {
    background: var(--secondary);
}

.bulk-add-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(51, 153, 255, 0.3);
}

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

.clear-all-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

.reset-data-btn {
    background: var(--warning);
}

.reset-data-btn:hover {
    background: #ea580c;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
}

.shipping-table-header {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr 1fr;
    gap: 1rem;
    background: var(--primary-gradient);
    color: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    font-weight: 700;
    margin-bottom: 1rem;
}

.table-cell {
    text-align: center;
}

.shipping-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.shipping-item {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr 1fr;
    gap: 1rem;
    align-items: center;
    background: var(--background-secondary);
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    padding: 1rem;
    transition: var(--transition);
}

.shipping-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateX(-5px);
}

.state-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    background: var(--background);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.state-select:focus {
    border-color: var(--primary);
    outline: none;
}

.price-input input {
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    text-align: center;
    font-weight: 600;
}

.price-input input:focus {
    border-color: var(--primary);
    outline: none;
}

.remove-shipping {
    background: var(--danger);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition);
    margin: 0 auto;
}

.remove-shipping:hover {
    background: #dc2626;
    transform: scale(1.1) rotate(90deg);
}

.generate-buttons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 2rem 0;
}

.preview-btn,
.generate-btn {
    padding: 1.25rem 2.5rem;
    border: none;
    border-radius: var(--border-radius-lg);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: inherit;
    min-width: 250px;
    justify-content: center;
    box-shadow: var(--shadow-lg);
}

.preview-btn {
    background: var(--secondary-gradient);
    color: white;
}

.preview-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(51, 153, 255, 0.4);
}

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

.generate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 166, 81, 0.4);
}

.download-info {
    background: linear-gradient(135deg, rgba(51, 153, 255, 0.1), rgba(96, 165, 250, 0.1));
    border: 2px solid var(--secondary);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.download-info i {
    font-size: 2rem;
    color: var(--secondary);
    margin-top: 0.25rem;
}

.download-info strong {
    display: block;
    margin-bottom: 0.75rem;
    color: var(--text);
    font-size: 1.1rem;
}

.download-info ul {
    margin: 0.75rem 0;
    padding-right: 1.5rem;
}

.download-info li {
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.download-info p {
    color: var(--text-muted);
    margin-top: 0.75rem;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeIn 0.3s ease-in-out;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--card-background);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
    animation: slideUp 0.4s ease-out;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2rem 2.5rem;
    border-bottom: 2px solid var(--border);
    background: var(--background-secondary);
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-header h3 i {
    color: var(--primary);
}

.close-modal {
    background: var(--background-tertiary);
    border: 2px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.25rem;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-modal:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.preview-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    background: var(--background-secondary);
}

.tab-btn {
    background: none;
    border: none;
    padding: 1.25rem 2rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.tab-btn i {
    font-size: 1.1rem;
}

.tab-btn.active,
.tab-btn:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--card-background);
}

.preview-content {
    flex: 1;
    overflow: hidden;
    background: var(--background-tertiary);
}

.preview-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.modal-footer {
    padding: 2rem 2.5rem;
    border-top: 2px solid var(--border);
    display: flex;
    justify-content: center;
    background: var(--background-secondary);
}

.download-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 1.25rem 3rem;
    border-radius: var(--border-radius-lg);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: inherit;
    font-size: 1.15rem;
    box-shadow: var(--shadow-lg);
}

.download-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-primary);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(15px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.loading-overlay.show {
    display: flex;
}

.loading-content {
    text-align: center;
    color: white;
}

.spinner {
    width: 80px;
    height: 80px;
    border: 6px solid rgba(255, 255, 255, 0.2);
    border-top: 6px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 2rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content p {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.loading-content small {
    font-size: 1rem;
    color: var(--text-muted);
}

.footer {
    background: var(--card-background);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    margin: 3rem 0 2rem 0;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.footer-content p {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.footer-content i {
    color: var(--danger);
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.footer-note {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-lg);
    color: white;
    font-weight: 600;
    z-index: 3000;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-xl);
    transform: translateX(400px);
    transition: var(--transition);
    max-width: 400px;
    animation: slideInRight 0.4s ease-out forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--secondary); }

.toast i {
    font-size: 1.25rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.9); }
}

#saveIndicator {
    box-shadow: var(--shadow-lg);
}

@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
    }

    .header {
        padding: 2rem 1.5rem;
        margin-top: 1rem;
    }

    .logo {
        flex-direction: column;
        gap: 0.75rem;
    }

    .logo i {
        font-size: 3rem;
    }

    .logo h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    .form-section {
        padding: 1.5rem;
    }

    .section-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .section-header i {
        margin-top: 0;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .shipping-controls {
        flex-direction: column;
    }

    .shipping-table-header {
        display: none;
    }

    .shipping-item {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .generate-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .preview-btn,
    .generate-btn {
        width: 100%;
        min-width: auto;
    }

    .modal {
        padding: 1rem;
    }

    .modal-header {
        padding: 1.5rem;
    }

    .modal-header h3 {
        font-size: 1.25rem;
    }

    .modal-footer {
        padding: 1.5rem;
    }

    .preview-tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1;
        min-width: 120px;
        padding: 1rem;
        font-size: 0.85rem;
    }

    .toast {
        right: 1rem;
        max-width: calc(100% - 2rem);
    }
}

@media (max-width: 480px) {
    .logo i {
        font-size: 2.5rem;
    }

    .logo h1 {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .section-header h2 {
        font-size: 1.5rem;
    }

    .feature-badge {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--background-secondary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

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