/**
 * WC AI Canvas Configurator - Frontend Styles
 */

/* Font */
@import url('https://fonts.googleapis.com/css2?family=Parkinsans:wght@300;400;500;600;700&display=swap');

/* Container */
.wc-aicc-configurator {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Parkinsans', var(--wp--preset--font--primary, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif);
}

/* Step Indicators */
.wc-aicc-step-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 30px;
    padding: 0 20px;
}

/* Inactive / Upcoming steps */
.wc-aicc-step-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #FFFFFF;
    border-radius: 20px;
    font-size: 14px;
    color: #555;
    transition: all 0.3s ease;
}

.wc-aicc-step-indicator .step-number {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e5e5e5;
    border-radius: 50%;
    font-weight: 600;
    font-size: 12px;
    color: #666;
}

/* Active step */
.wc-aicc-step-indicator--active {
    background: #EB662C;
    color: #fff;
}

.wc-aicc-step-indicator--active .step-number {
    background: #fff;
    color: #EB662C;
}

/* Completed step */
.wc-aicc-step-indicator--completed {
    background: rgba(144, 174, 93, 0.15);
    color: #90AE5D;
}

.wc-aicc-step-indicator--completed .step-number {
    background: #90AE5D;
    color: #fff;
}

/* Steps Container */
.wc-aicc-steps {
    min-height: 400px;
}

.wc-aicc-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.wc-aicc-step.active {
    display: block;
}

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

/* Step Header */
.wc-aicc-step-header {
    text-align: center;
    margin-bottom: 24px;
}

.wc-aicc-step-header h3 {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 600;
}

.wc-aicc-step-header p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Variation Selection */
.wc-aicc-variations {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.wc-aicc-variation-btn {
    padding: 20px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.wc-aicc-variation-btn:hover {
    border-color: #2271b1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.wc-aicc-variation-btn--selected {
    border-color: #2271b1;
    background: #f0f7fc;
}

.wc-aicc-variation-btn .size-label {
    display: block;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.wc-aicc-variation-btn .price {
    display: block;
    color: #2271b1;
    font-size: 16px;
    font-weight: 500;
}

.wc-aicc-variation-btn .aspect-ratio {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.wc-aicc-variation-btn:disabled,
.wc-aicc-variation-btn--out-of-stock {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Upload Zone */
.wc-aicc-drop-zone {
    border: 2px dashed #ccc;
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wc-aicc-drop-zone:hover,
.wc-aicc-drop-zone--active {
    border-color: #2271b1;
    background: #f0f7fc;
}

.wc-aicc-drop-zone-icon {
    font-size: 48px;
    margin-bottom: 16px;
    color: #999;
}

.wc-aicc-drop-zone h4 {
    margin: 0 0 8px;
    font-size: 18px;
}

.wc-aicc-drop-zone p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.wc-aicc-browse-btn {
    display: inline-block;
    margin-top: 16px;
    padding: 10px 24px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
    font-family: inherit;
}

.wc-aicc-browse-btn:hover {
    background: #135e96;
}

.wc-aicc-file-input {
    display: none;
}

.wc-aicc-upload-preview {
    display: none;
    text-align: center;
    margin-bottom: 24px;
}

.wc-aicc-upload-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.wc-aicc-upload-preview-caption {
    margin: 16px 0 0;
    text-align: center;
    font-size: 14px;
    color: #666;
    line-height: 1.45;
}

/* Step 3: Customize sub-steps & choice cards */
.wc-aicc-customize-substeps {
    margin-bottom: 8px;
}

.wc-aicc-customize-panel__intro {
    text-align: center;
    margin-bottom: 20px;
}

.wc-aicc-customize-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 4px 12px;
    margin-bottom: 10px;
    background: rgba(235, 102, 44, 0.12);
    color: #c24f1e;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 600;
}

.wc-aicc-customize-panel__title {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
}

.wc-aicc-customize-panel__meta {
    margin: 0;
    font-size: 13px;
    color: #888;
}

.wc-aicc-choice-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 8px;
}

.wc-aicc-choice-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 16px 14px;
    min-height: 88px;
    text-align: left;
    background: #fff;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    font-family: inherit;
}

.wc-aicc-choice-card:hover {
    border-color: #ccc;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.wc-aicc-choice-card:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.2);
}

.wc-aicc-choice-card--selected {
    border-color: #EB662C;
    background: rgba(235, 102, 44, 0.06);
    box-shadow: 0 4px 16px rgba(235, 102, 44, 0.15);
}

.wc-aicc-choice-card__label {
    font-size: 15px;
    font-weight: 600;
    color: #222;
    line-height: 1.25;
}

.wc-aicc-choice-card__hint {
    font-size: 12px;
    color: #777;
    line-height: 1.35;
}

.wc-aicc-situation-custom-wrap {
    margin-top: 18px;
    margin-bottom: 4px;
}

.wc-aicc-situation-custom-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.wc-aicc-situation-custom-input {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 88px;
    padding: 12px 14px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.45;
    resize: vertical;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wc-aicc-situation-custom-input::placeholder {
    color: #999;
}

.wc-aicc-situation-custom-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.wc-aicc-customize-actions {
    margin-top: 20px;
}

/* Legacy option grid (if used elsewhere) */
.wc-aicc-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.wc-aicc-option-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wc-aicc-option-field label {
    font-weight: 500;
    font-size: 14px;
}

.wc-aicc-option-select {
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    cursor: pointer;
}

.wc-aicc-option-select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.1);
}

/* Legacy Notes - removed, keep wrapper for potential future use */
.wc-aicc-notes-wrapper {
    margin: 24px 0;
}

.wc-aicc-notes-wrapper label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.wc-aicc-notes {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    min-height: 100px;
}

.wc-aicc-notes:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.1);
}

/* Generate Status */
.wc-aicc-generate-status {
    display: none;
    text-align: center;
    padding: 40px;
    background: #f9f9f9;
    border-radius: 12px;
    margin: 24px 0;
}

.wc-aicc-generate-patience {
    margin: 14px auto 0;
    max-width: 320px;
    font-size: 14px;
    line-height: 1.45;
    color: #666;
}

/* Preview */
.wc-aicc-preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.wc-aicc-preview-item {
    text-align: center;
}

.wc-aicc-preview-item h4 {
    margin: 0 0 12px;
    font-size: 16px;
    color: #666;
}

.wc-aicc-preview-item img {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Summary */
.wc-aicc-summary {
    background: #f9f9f9;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.wc-aicc-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.wc-aicc-summary-row:last-child {
    border-bottom: none;
}

.wc-aicc-summary-row .label {
    color: #666;
}

.wc-aicc-summary-row .value {
    font-weight: 500;
}

/* Buttons */
.wc-aicc-btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 24px;
}

.wc-aicc-back-btn,
.wc-aicc-customize-back-btn,
.wc-aicc-next-btn,
.wc-aicc-customize-next-btn,
.wc-aicc-generate-btn,
.wc-aicc-add-to-cart-btn,
.wc-aicc-retry-btn,
.wc-aicc-browse-btn {
    padding: 14px 32px;
    border: none;
    border-radius: 9999px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

/* Retry button spans full width when alone */
.wc-aicc-retry-btn {
    grid-column: 1 / -1;
}

.wc-aicc-back-btn,
.wc-aicc-customize-back-btn {
    background: #f0f0f0;
    color: #333;
}

.wc-aicc-back-btn:hover,
.wc-aicc-customize-back-btn:hover {
    background: #e0e0e0;
}

.wc-aicc-next-btn,
.wc-aicc-customize-next-btn,
.wc-aicc-generate-btn {
    background: #EB662C;
    color: #fff;
}

.wc-aicc-next-btn:hover,
.wc-aicc-customize-next-btn:hover,
.wc-aicc-generate-btn:hover {
    background: #d45a24;
}

.wc-aicc-next-btn:active,
.wc-aicc-customize-next-btn:active,
.wc-aicc-generate-btn:active {
    background: #c24f1e;
}

.wc-aicc-next-btn:disabled,
.wc-aicc-customize-next-btn:disabled,
.wc-aicc-generate-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.wc-aicc-add-to-cart-btn {
    background: #1e8e3e;
    color: #fff;
}

.wc-aicc-add-to-cart-btn:hover {
    background: #188038;
}

.wc-aicc-retry-btn {
    background: #ff6b6b;
    color: #fff;
}

.wc-aicc-retry-btn:hover {
    background: #ee5a5a;
}

/* Error Message */
.wc-aicc-error-message {
    display: none;
    background: #fce8e8;
    border: 1px solid #f5c6c6;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    text-align: center;
    color: #c53929;
}

/* Spinner */
.wc-aicc-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top-color: #EB662C;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

/* Responsive */
@media (max-width: 768px) {
    .wc-aicc-step-indicators {
        flex-wrap: wrap;
    }

    .wc-aicc-step-indicator .step-text {
        display: none;
    }

    .wc-aicc-variations {
        grid-template-columns: repeat(2, 1fr);
    }

    .wc-aicc-options-grid {
        grid-template-columns: 1fr;
    }

    .wc-aicc-choice-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .wc-aicc-preview-grid {
        grid-template-columns: 1fr;
    }

    /* Back on left, Next/Generate/Add-to-cart on right – same as desktop */
    .wc-aicc-btn-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    /* Equal width buttons on mobile */
    .wc-aicc-back-btn,
    .wc-aicc-customize-back-btn,
    .wc-aicc-next-btn,
    .wc-aicc-customize-next-btn,
    .wc-aicc-generate-btn,
    .wc-aicc-add-to-cart-btn {
        width: 100%;
        min-width: 0;
    }
}
