/* WelderBox - Optimized for performance */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: var(--gray-900);
    background: var(--gray-50);
}

/* Layout */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1rem;
}

header {
    background: var(--gray-900);
    color: white;
    padding: 1rem 0;
    margin-bottom: 2rem;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
}

.logo span {
    color: var(--primary);
}

nav a {
    color: var(--gray-300);
    text-decoration: none;
    margin-left: 1.5rem;
}

nav a:hover {
    color: white;
}

/* Form Layout */
.quote-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 800px) {
    .quote-layout {
        grid-template-columns: 1fr;
    }
    .quote-summary {
        position: static !important;
        order: 1; /* Show after form on mobile */
    }
    .quote-form {
        order: 0;
    }
    /* Make toggle buttons stack better on small screens */
    .toggle-group {
        flex-direction: column;
    }
    .toggle-btn {
        width: 100%;
    }
}

/* Cards */
.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.label-hint {
    font-weight: 400;
    color: var(--gray-500);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.15s;
}

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

textarea {
    resize: vertical;
    min-height: 80px;
}

/* Toggle Buttons */
.toggle-group {
    display: flex;
    gap: 0.5rem;
}

.toggle-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-300);
    background: white;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
    text-align: center;
    transition: all 0.15s;
}

.toggle-btn:hover {
    border-color: var(--primary);
}

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

/* Checkboxes */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.checkbox-label {
    font-size: 0.875rem;
}

.checkbox-label strong {
    display: block;
    margin-bottom: 0.125rem;
}

.checkbox-label span {
    color: var(--gray-500);
}

/* Conditional fields */
.conditional-field {
    display: none;
    margin-top: 0.75rem;
    padding-left: 1.75rem;
}

.conditional-field.visible {
    display: block;
}

/* Photo Upload */
.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.upload-zone-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.upload-zone-text {
    color: var(--gray-500);
}

.upload-zone-text strong {
    color: var(--primary);
}

.photo-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.photo-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.25rem;
}

.photo-preview-item button {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: none;
    background: var(--danger);
    color: white;
    cursor: pointer;
    font-size: 0.75rem;
}

/* Quote Summary */
.quote-summary {
    position: sticky;
    top: 1rem;
}

.quote-summary .card {
    border: 2px solid var(--primary);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.9375rem;
}

.summary-row.subtotal {
    border-top: 1px solid var(--gray-200);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
}

.summary-row.total {
    font-size: 1.25rem;
    font-weight: 700;
    border-top: 2px solid var(--gray-900);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
}

.summary-label {
    color: var(--gray-500);
}

.summary-value {
    font-weight: 500;
}

.deposit-note {
    background: var(--gray-100);
    padding: 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    margin-top: 1rem;
}

.deposit-note strong {
    color: var(--primary);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-rush {
    background: var(--warning);
    color: white;
}

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

/* Warnings */
.warning-box {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 0.375rem;
    padding: 0.75rem;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.warning-box strong {
    color: #b45309;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    text-decoration: none;
}

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

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

.btn-primary:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* Disclaimers Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.visible {
    display: flex;
}

.modal {
    background: white;
    border-radius: 0.5rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    font-size: 1.125rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Success Page */
.success-card {
    text-align: center;
    max-width: 500px;
    margin: 2rem auto;
}

.success-icon {
    width: 4rem;
    height: 4rem;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1rem;
}

.ticket-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin: 1rem 0;
}

.qr-code {
    margin: 1.5rem 0;
}

.qr-code img,
.qr-code canvas {
    max-width: 200px;
}

/* Tracking Page */
.tracking-search {
    max-width: 400px;
    margin: 0 auto 2rem;
    display: flex;
    gap: 0.5rem;
}

.tracking-search input {
    flex: 1;
}

.timeline {
    max-width: 500px;
    margin: 0 auto;
}

.timeline-item {
    display: flex;
    gap: 1rem;
    padding-bottom: 1.5rem;
    position: relative;
}

.timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 2rem;
    bottom: 0;
    width: 2px;
    background: var(--gray-200);
}

.timeline-item.completed::before {
    background: var(--success);
}

.timeline-dot {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--gray-200);
    flex-shrink: 0;
}

.timeline-item.completed .timeline-dot {
    background: var(--success);
}

.timeline-item.current .timeline-dot {
    background: var(--primary);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0); }
}

.timeline-content h4 {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.timeline-content p {
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* Admin Styles */
.admin-header {
    background: var(--gray-900);
    color: white;
    padding: 1rem 0;
    margin-bottom: 2rem;
}

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

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

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    color: var(--gray-500);
    font-size: 0.875rem;
}

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

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

.orders-table th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-500);
    text-transform: uppercase;
}

.orders-table tr:hover {
    background: var(--gray-50);
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-awaiting_shipment { background: #fef3c7; color: #b45309; }
.status-received { background: #dbeafe; color: #1d4ed8; }
.status-in_progress { background: #e0e7ff; color: #4338ca; }
.status-completed { background: #d1fae5; color: #047857; }
.status-shipped { background: #cffafe; color: #0891b2; }
.status-forfeited { background: #fee2e2; color: #b91c1c; }

/* Utility */
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* Loading spinner */
.spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

/* Site Footer */
.site-footer {
    margin-top: 3rem;
    padding: 1.5rem 0;
    background: var(--gray-900);
    color: var(--gray-500);
    text-align: center;
    font-size: 0.875rem;
}

.site-footer a {
    color: var(--gray-400);
    text-decoration: none;
}

.site-footer a:hover {
    color: white;
}
