/**
 * Valhalla Orders - Frontend Styles
 */

 :root {
    --valorder-colour-primary: #177CC1;
    --valorder-colour-primary-light: #BBD8ED;
 }

/* Order Form Page Layout */
.order-form-page {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, sans-serif;
}

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

.order-form-wrapper {
    background: #fff;
}

/* Header */
.order-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.order-form-header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

.print-button {
    padding: 0.75rem 1.5rem;
    background: var(--valorder-colour-primary);
    color: white;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
}

.print-button:hover {
    background: #1d4ed8;
}

/* Form content */
.order-form-content {
    padding: 1rem 0;
}

/* Shortcode Form Wrapper */
.valhalla-order-form-wrapper {
    /* max-width: 800px; */
    margin: 2rem auto;
    /* padding: 2rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); */
}

.valhalla-order-form-wrapper h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* PWA Install Notification */
.pwa-install-notification {
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    background: linear-gradient(60deg,rgba(227, 221, 230, 1) 0%, rgba(227, 221, 230, 1) 25%, rgba(236, 231, 231, 1) 25%, rgba(236, 231, 231, 1) 47.5%, rgba(248, 235, 237, 1) 47.5%, rgba(248, 235, 237, 1) 70%, rgba(228, 243, 240, 1) 70%, rgba(228, 243, 240, 1) 100%);

}

.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: black;
}

.pwa-install-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

.pwa-install-text {
    flex: 1;
}

.pwa-install-text strong {
    display: block;
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
}

.pwa-install-text p {
    margin: 0;
    font-size: 0.875rem;
    opacity: 0.95;
}

.pwa-install-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.pwa-install-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.pwa-install-close:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

@media (max-width: 640px) {
    .pwa-install-notification {
        padding: 1rem;
    }

    .pwa-install-content {
        gap: 0.75rem;
    }

    .pwa-install-icon {
        font-size: 1.5rem;
    }

    .pwa-install-text strong {
        font-size: 1rem;
    }

    .pwa-install-text p {
        font-size: 0.8125rem;
    }
}

/* Screen/Print visibility */
.order-form-screen-only {
    display: block;
}

.order-form-print-only {
    display: none;
}

/* Step Indicator */
.order-form-steps {
    display: flex;
    justify-content: center;
    gap: 2rem;
    /* margin-bottom: 2rem; */
    padding-bottom: 2rem;
    /* border-bottom: 2px solid #e5e7eb; */
}

.order-form-steps .step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.order-form-steps .step.active {
    opacity: 1;
}

.order-form-steps .step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    font-weight: 600;
    font-size: 1.125rem;
    transition: all 0.3s ease;
}

.order-form-steps .step.active .step-number {
    background: var(--valorder-colour-primary);
    color: white;
}

.order-form-steps .step-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
}

.order-form-steps .step.active .step-label {
    color: #111827;
    font-weight: 600;
}

/* Multi-step Form */
.form-step {
    display: none;
}

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

/* Form Navigation */
.form-navigation {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    /* margin-top: 2rem; */
    padding-top: 1.5rem;
    /* border-top: 1px solid #e5e7eb; */
}

.form-navigation button {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.form-navigation .button-prev {
    margin-right: auto;
}

.form-navigation .button-primary {
    background: var(--valorder-colour-primary);
    color: #fff;
    border-color: var(--valorder-colour-primary);
}

.form-navigation .button-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.form-navigation .button-primary:active {
    transform: translateY(0);
}

.form-navigation .button-secondary {
    background: #fff;
    color: #374151;
    border-color: #d1d5db;
}

.form-navigation .button-secondary:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-navigation .button-secondary:active {
    transform: translateY(0);
}

.form-navigation .button-link {
    background: transparent;
    color: var(--valorder-colour-primary);
    border: none;
    padding: 0.5rem 1rem;
    font-weight: 500;
}

.form-navigation .button-link:hover {
    color: #1d4ed8;
    background: #eff6ff;
    transform: none;
    box-shadow: none;
}

/* Review Section */
.review-section {
    position: relative;
}

.review-section .review-intro {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.review-section h4 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
    font-weight: 600;
}

.review-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.review-item {
    display: flex;
    gap: 0.5rem;
}

.review-item strong {
    min-width: 80px;
    color: #6b7280;
    font-weight: 500;
}

.review-value {
    color: #111827;
    font-weight: 600;
}

.review-notes {
    padding: 1rem;
    background: white;
    border-radius: 4px;
    margin-bottom: 1rem;
    min-height: 60px;
}

.review-products-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.review-products-table thead {
    background: #f9fafb;
}

.review-products-table th,
.review-products-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.review-products-table th {
    font-weight: 600;
    color: #6b7280;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.review-products-table td {
    color: #111827;
}

.review-products-table tbody tr:last-child td {
    border-bottom: none;
}

.review-category-header td {
    background: #f3f4f6;
    font-weight: 700;
    color: #1f2937;
    padding: 0.875rem 0.75rem;
    border-top: 2px solid #d1d5db;
    border-bottom: 1px solid #d1d5db;
}

.review-category-header:first-child td {
    border-top: none;
}

.review-product-name {
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.25rem;
}

.review-product-description {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.edit-section-button {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    background: #fff;
    color: var(--valorder-colour-primary);
    text-decoration: none;
    border: 2px solid var(--valorder-colour-primary);
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.edit-section-button:hover {
    background: var(--valorder-colour-primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.edit-section-button:active {
    transform: translateY(0);
}

@media (max-width: 640px) {
    .order-form-steps {
        gap: 1rem;
    }

    .order-form-steps .step-number {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .order-form-steps .step-label {
        font-size: 0.75rem;
    }

    .form-navigation {
        flex-direction: column-reverse;
    }

    .form-navigation button {
        width: 100%;
    }

    .form-navigation .button-prev {
        margin-right: 0;
    }

    .edit-section-button {
        width: 100%;
        text-align: center;
    }
}

.valhalla-order-form .form-group {
    margin-bottom: 1.5rem;
}

.valhalla-order-form .form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.valhalla-order-form .form-section h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

/* Category Navigation */
.form-step {
    container-type: inline-size;
    container-name: form-step;
}

.category-navigation {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

@container form-step (min-width: 400px) {
    .category-navigation {
        grid-template-columns: repeat(2, 1fr);
    }
}

.category-navigation .category-nav-link {
    display: block;
    padding: 1rem 1.5rem;
    background: #fff;
    color: var(--valorder-colour-primary);
    text-decoration: none;
    border: 2px solid var(--valorder-colour-primary);
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    transition: all 0.2s ease;
}

.category-navigation .category-nav-link:hover {
    background: var(--valorder-colour-primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.category-navigation .category-nav-link:active {
    transform: translateY(0);
}

@media (max-width: 640px) {
    .category-navigation {
        padding: 1rem;
        gap: 0.5rem;
    }

    .category-navigation .category-nav-link {
        padding: 0.875rem 1.25rem;
        font-size: 0.9375rem;
    }
}

/* Category-grouped products */
.valhalla-order-form .product-category-group {
    margin-bottom: 1.5rem;
}

.valhalla-order-form .product-category-group:last-child {
    margin-bottom: 2rem;
}

.valhalla-order-form .category-heading {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--valorder-colour-primary);
    border-bottom: 2px solid var(--valorder-colour-primary);
    padding-bottom: 0.5rem;
}

.valhalla-order-form .product-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.valhalla-order-form .product-row:last-child {
    margin-bottom: 0;
}

.valhalla-order-form .product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.valhalla-order-form .product-info strong {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.valhalla-order-form .product-description {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Mobile responsiveness */
@media (max-width: 640px) {
    .valhalla-order-form .product-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .valhalla-order-form-wrapper {
        padding: 1rem;
    }
}

.valhalla-order-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.valhalla-order-form .required {
    color: #d63638;
}

.valhalla-order-form .field-help-text {
    margin: 0.5rem 0 0 0;
    font-size: 0.875rem;
    color: #6b7280;
    font-style: italic;
}

.valhalla-order-form input[type="text"],
.valhalla-order-form input[type="email"],
.valhalla-order-form input[type="tel"],
.valhalla-order-form input[type="date"],
.valhalla-order-form select,
.valhalla-order-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    background-color: #fff;
}

/* Style select element cursor */
.valhalla-order-form select {
    cursor: pointer;
}

/* Style the date picker calendar icon */
.valhalla-order-form input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(37%) sepia(94%) saturate(1234%) hue-rotate(179deg) brightness(94%) contrast(89%);
}

.valhalla-order-form input[type="date"]::-webkit-calendar-picker-indicator:hover {
    filter: invert(37%) sepia(94%) saturate(1234%) hue-rotate(179deg) brightness(80%) contrast(89%);
}

.valhalla-order-form textarea {
    resize: vertical;
}

.valhalla-order-form button[type="submit"] {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    cursor: pointer;
}

.valhalla-order-form button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading Spinner */
.submit-button-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.loading-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner.visible {
    display: inline-block;
}

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

.valhalla-order-form .form-message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 4px;
}

.valhalla-order-form .form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.valhalla-order-form .form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Success Screen */
.order-success-screen {
    display: none;
    text-align: center;
    padding: 3rem 2rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.order-success-screen.visible {
    display: block;
}

.order-success-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.order-success-screen h3 {
    margin: 0 0 1rem 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: #10b981;
}

.order-success-screen .success-order-number {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1.5rem;
}

.order-success-screen .success-message {
    color: #6b7280;
    margin-bottom: 2rem;
    font-size: 1rem;
    line-height: 1.6;
}

.order-success-screen .button-primary {
    display: inline-block;
    padding: 0.875rem 2rem;
    background: var(--valorder-colour-primary);
    color: #fff;
    border: 2px solid var(--valorder-colour-primary);
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.order-success-screen .button-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.order-success-screen .button-primary:active {
    transform: translateY(0);
}

@media (max-width: 640px) {
    .order-success-screen {
        padding: 2rem 1rem;
    }

    .order-success-icon {
        font-size: 3rem;
    }

    .order-success-screen h3 {
        font-size: 1.5rem;
    }

    .order-success-screen .success-order-number {
        font-size: 1.125rem;
    }

    .order-success-screen .button-primary {
        width: 100%;
    }
}

/* Order History */
.valhalla-order-history-wrapper {
    margin: 2rem 0;
}

.valhalla-orders-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

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

.valhalla-orders-table th {
    background: #f5f5f5;
    font-weight: 600;
}

.valhalla-orders-table .order-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 3px;
    font-size: 0.875rem;
    font-weight: 600;
}

.valhalla-orders-table .order-status.status-pending {
    background: #fff3cd;
    color: #856404;
}

.valhalla-orders-table .order-status.status-processing {
    background: #cfe2ff;
    color: #084298;
}

.valhalla-orders-table .order-status.status-completed {
    background: #d1e7dd;
    color: #0f5132;
}

.valhalla-orders-table .order-status.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* Print-only styles */
.order-form-print-only {
    font-family: system-ui, -apple-system, sans-serif;
}

.order-print-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.order-print-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.order-print-date {
    color: #6b7280;
    font-size: 0.875rem;
}

.order-print-section {
    margin-bottom: 2rem;
}

.order-print-section h4 {
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.order-print-field {
    margin-bottom: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.order-print-field strong {
    min-width: 100px;
}

.order-print-products {
    width: 100%;
    border-collapse: collapse;
}

.order-print-products th,
.order-print-products td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.order-print-products th {
    background: #f9fafb;
    font-weight: 600;
}

/* Print media query */
@media print {
    /* Hide screen-only elements */
    .print-button,
    .order-form-screen-only,
    .pwa-install-notification {
        display: none !important;
    }

    /* Show print-only elements */
    .order-form-print-only {
        display: block !important;
    }

    /* Optimize layout for printing */
    .valhalla-order-form-wrapper {
        box-shadow: none;
        padding: 0;
        margin: 0;
    }

    .order-form-container {
        max-width: 100%;
        padding: 0;
    }

    .order-form-header {
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
    }

    .order-form-header h1 {
        font-size: 1.5rem;
    }

    /* Ensure content doesn't break across pages awkwardly */
    .order-print-section {
        page-break-inside: avoid;
    }

    /* Remove backgrounds for better printing */
    body {
        background: white !important;
    }

    /* Clean table borders for printing */
    .order-print-products th {
        background: #f5f5f5 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Print page setup */
@page {
    margin: 1cm;
    size: letter;
}
