/**
 * WC Steps Order - Frontend Styles
 * Modern, responsive design with CSS variables
 */

:root {
    --wc-primary: #00387E;
    --wc-primary-hover: #1d4ed8;
    --wc-secondary: #64748b;
    --wc-success: #10b981;
    --wc-warning: #f59e0b;
    --wc-error: #ef4444;
    --wc-border: #000;
    --wc-bg-light: #f8fafc;
    --wc-bg-light-alt: #f7f7f7;
    --wc-text: #1e293b;
    --wc-dark: #000;
    --wc-text-light: #64748b;
    --wc-radius: 8px;
    --wc-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --wc-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --wc-transition: all 0.3s ease;
}

/* Container */
.wc-steps-order {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: var(--wc-radius);
    box-shadow: var(--wc-shadow-lg);
}

.wc-step-2 {
    font-family: var(--font-dm-sans);
}

/* Progress Bar */
.wc-steps-progress {
    margin-bottom: 3rem;
}

.wc-steps-progress-bar {
    height: 4px;
    background: var(--wc-bg-light-alt);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.wc-steps-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--wc-primary), var(--wc-primary-hover));
    transition: width 0.4s ease;
}

.wc-steps-progress-labels {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.wc-step-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--wc-text-light);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--wc-transition);
}

.wc-step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--wc-bg-light);
    border: 2px solid var(--wc-border);
    font-weight: 600;
    transition: var(--wc-transition);
}

.wc-step-label.active {
    color: var(--wc-primary);
}

.wc-step-label.active .wc-step-number {
    background: var(--wc-primary);
    border-color: var(--wc-primary);
    color: #fff;
}

.wc-step-label.completed .wc-step-number {
    background: var(--wc-success);
    border-color: var(--wc-success);
    color: #fff;
}

/* Steps */
.wc-step {
    display: none;
}

.wc-step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Header Wrapper - Two Column Layout */
.wc-header-wrapper {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3rem;
    align-items: start;
    margin-bottom: 2.5rem;
}

/* Page Header */
.wc-page-header {
    max-width: 890px;
}

.wc-page-title {
    margin: 0 0 1rem 0;
    color: var(--wc-primary);
    font-family: var(--font-roca);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.wc-page-description {
    color: var(--wc-text-light);
    font-size: 1rem;
    line-height: 1.6;
}

.wc-page-description p {
    margin: 0 0 1rem 0;
}

.wc-page-description p:last-child {
    margin-bottom: 0;
}

.wc-page-description ul,
.wc-page-description ol {
    margin: 0 0 1rem 1.5rem;
}

.wc-page-description strong {
    font-weight: 600;
    color: var(--wc-text);
}

/* Category Filter */
.wc-category-filter {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem;
    background: var(--wc-bg-light);
    border-radius: var(--wc-radius);
    border: 1px solid var(--wc-border);
    min-width: 280px;
    align-self: start;
    position: sticky;
    top: 20px;
}

.wc-category-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--wc-text);
    font-size: 0.9375rem;
    font-weight: 600;
    white-space: nowrap;
    margin: 0;
}

.wc-category-label svg {
    color: var(--wc-primary);
    flex-shrink: 0;
}

.wc-category-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid var(--wc-border);
    border-radius: var(--wc-radius);
    color: var(--wc-text);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--wc-transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 20px;
    padding-right: 2.5rem;
    text-transform: capitalize;
}

.wc-category-select option {
    text-transform: capitalize;
}

.wc-category-select:hover {
    border-color: var(--wc-primary);
}

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

/* Products Table */
.wc-products-table-wrapper {
    overflow-x: auto;
    margin-bottom: 2rem;
    font-family: var(--font-dm-sans);
}

.wc-products-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.wc-products-table thead {
    border-bottom: 2px solid var(--wc-border);
    font-size:17px;
    font-weight: bold;
}

.wc-products-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--wc-text);
    white-space: nowrap;
}

.wc-products-table td {
    padding: 5px 5px 5px 5px;
    vertical-align: middle;
    font-size: 16px;
}

.wc-first-attribute {
    font-weight: 700;
}

.wc-product-row {
    transition: var(--wc-transition);
}

.wc-product-row:first-child td {
    padding-top: 17px;
    border-top: 2px solid var(--wc-border);
}

@media (max-width: 768px) {
    .wc-product-row:first-child td {
        border-top: none;
    }
}

.wc-product-row:hover {
    background: var(--wc-bg-light);
}

.wc-product-row.wc-selected {
    background: #fff500;
}

.wc-product-row.wc-highlight {
    animation: highlight 2s ease;
}

@keyframes highlight {
    0%, 100% {
        background: transparent;
    }
    50% {
        background: #fef3c7;
    }
}

/* Quantity Input */
.wc-col-qty {
    width: 100px;
}

/* Weight Column */
.wc-col-weight {
    width: 100px;
    text-align: center;
}

/* Category Column */
.wc-col-category {
    min-width: 150px;
    max-width: 200px;
    font-size: 17px;
    color: var(--wc-text-light);
}

.wc-product-qty {
    width: 65px;
    height: 30px;
    border: 1px solid var(--wc-border);
    border-radius: 3px;
    font-size: 0.875rem;
    text-align: center;
    transition: var(--wc-transition);
}

.wc-product-qty:focus {
    outline: none;
    border-color: var(--wc-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Product Link */
.wc-product-link {
    color: var(--wc-primary);
    text-decoration: none;
    font-weight: 700;
    transition: var(--wc-transition);
}

.wc-product-link:hover {
    text-decoration: underline;
}

/* Product SKU */
.wc-product-sku {
    color: var(--wc-primary);
    font-weight: 600;
    font-size: 0.9em;
}

.wc-product-price {
    display: block;
    margin-top: 0.25rem;
    color: var(--wc-text-light);
    font-size: 0.8125rem;
}

/* Customer Form */
.wc-customer-form {
    margin-top: 2rem;
}

.wc-customer-form h3 {
    margin-bottom: 1.5rem;
    color: var(--wc-text);
    font-size: 1.5rem;
}

.wc-selected-products {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--wc-bg-light);
    border-radius: var(--wc-radius);
}

.wc-selected-products h4 {
    margin-bottom: 1rem;
    color: var(--wc-text);
    font-size: 1.125rem;
}

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

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

.wc-summary-table th {
    font-weight: 600;
    background: #fff;
}

.wc-summary-table .wc-summary-total {
    border-top: 2px solid var(--wc-border);
    background: var(--wc-bg-light);
}

.wc-summary-table .wc-summary-total td {
    padding: 1rem 0.75rem;
    font-size: 1.05rem;
}

/* Form Fields */
.wc-form-row {
    margin-bottom: 1.5rem;
}

.wc-form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.wc-form-field label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--wc-text);
    font-weight: 500;
    font-size: 0.875rem;
}

.wc-form-field .required {
    color: var(--wc-error);
}

.wc-form-field input,
.wc-form-field select,
.wc-form-field textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--wc-border);
    border-radius: var(--wc-radius);
    font-size: 0.875rem;
    transition: var(--wc-transition);
}

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

.wc-form-field textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.wc-field-description {
    display: block;
    margin-top: 0.5rem;
    color: var(--wc-text-light);
    font-size: 0.8125rem;
    font-style: italic;
}

/* Buttons */
.wc-step-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--wc-border);
}

.wc-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    background: var(--wc-primary);
    color: #fff;
    border: none;
    border-radius: var(--wc-radius);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--wc-transition);
    box-shadow: var(--wc-shadow);
}

.wc-btn:hover {
    background: var(--wc-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--wc-shadow-lg);
}

.wc-btn:active {
    transform: translateY(0);
}

.wc-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

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

.wc-btn-secondary:hover {
    background: #475569;
}

.wc-btn svg {
    width: 20px;
    height: 20px;
}

.wc-selected-count {
    margin-left: 0.25rem;
    padding: 0.125rem 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 0.8125rem;
}

/* Register Button (Bottom) */
.wc-register-bottom {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--wc-border);
    text-align: center;
    display: none; /* Hidden by default, shown after form submission */
}

.wc-register-wrapper {
    position: relative;
    display: inline-flex;
}

.wc-btn-register {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    background: var(--wc-success);
    color: #fff;
    border: none;
    border-radius: var(--wc-radius);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--wc-transition);
    box-shadow: var(--wc-shadow);
    text-decoration: none;
}

.wc-btn-register:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--wc-shadow-lg);
    color: #fff;
}

.wc-btn-register:active {
    transform: translateY(0);
}

.wc-btn-register svg {
    width: 20px;
    height: 20px;
}

/* Register Tooltip */
.wc-register-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--wc-dark);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: var(--wc-radius);
    font-size: 0.875rem;
    line-height: 1.4;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--wc-transition);
    pointer-events: none;
    z-index: 1000;
    box-shadow: var(--wc-shadow-lg);
    max-width: 280px;
    white-space: normal;
    text-align: center;
}

.wc-register-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--wc-dark);
}

.wc-register-wrapper:hover .wc-register-tooltip {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 15px);
}

/* Loading Overlay */
.wc-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

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

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

/* Floating Action Button */
.wc-floating-next {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    width: calc(100% - 40px);
    max-width: 600px;
    padding: 1.25rem 2rem;
    background: var(--wc-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.wc-floating-next.wc-show {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.wc-floating-next.wc-hide-bottom {
    transform: translateX(-50%) translateY(150%);
}

.wc-floating-next:hover {
    transform: translateX(-50%) translateY(-4px);
}

.wc-floating-next:active {
    transform: translateX(-50%) translateY(-2px);
}

.wc-floating-next-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    font-size: 0.875rem;
    font-weight: 700;
}

/* Notifications */
.wc-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 300px;
    max-width: 500px;
    padding: 1rem 1.5rem;
    background: #fff;
    border-radius: var(--wc-radius);
    box-shadow: var(--wc-shadow-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    z-index: 10000;
    transform: translateX(calc(100% + 40px));
    transition: transform 0.3s ease;
}

.wc-notification-show {
    transform: translateX(0);
}

.wc-notification-success {
    border-left: 4px solid var(--wc-success);
}

.wc-notification-error {
    border-left: 4px solid var(--wc-error);
}

.wc-notification-warning {
    border-left: 4px solid var(--wc-warning);
}

.wc-notification-message {
    flex: 1;
    color: var(--wc-text);
    font-size: 0.875rem;
}

.wc-notification-close {
    background: none;
    border: none;
    color: var(--wc-text-light);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--wc-transition);
}

.wc-notification-close:hover {
    color: var(--wc-text);
}

/* Responsive */
@media (max-width: 768px) {
    .wc-steps-order {
        padding: 1rem;
        margin: 1rem;
    }

    .wc-steps-progress-labels {
        flex-direction: column;
        gap: 0.75rem;
    }

    .wc-step-text {
        font-size: 0.8125rem;
    }
    
    .wc-header-wrapper {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .wc-page-header {
        max-width: 100%;
    }
    
    .wc-page-title {
        font-size: 1.5rem;
        color: var(--wc-text);
    }
    
    .wc-page-description {
        font-size: 0.9375rem;
    }

    .wc-category-filter {
        position: static;
        min-width: 100%;
        padding: 1rem;
    }
    
    .wc-category-label {
        font-size: 0.875rem;
    }
    
    .wc-category-select {
        font-size: 0.875rem;
    }

    /* Transform table into cards on mobile */
    .wc-products-table-wrapper {
        overflow-x: visible;
    }
    
    .wc-products-table thead {
        display: none;
    }
    
    .wc-products-table,
    .wc-products-table tbody,
    .wc-products-table tr,
    .wc-products-table td {
        display: block;
        width: 100%;
    }
    
    .wc-product-row {
        margin-bottom: 1rem;
        border: 1px solid var(--wc-border);
        border-radius: var(--wc-radius);
        padding: 1rem;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }
    
    .wc-product-row:hover {
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
    
    .wc-products-table td {
        padding: 0.5rem 0;
        border: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .wc-products-table td:before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--wc-text);
        margin-right: 1rem;
        flex-shrink: 0;
    }

    .wc-col-attribute {
        font-weight: 500;
    }
    
    .wc-col-qty {
        width: auto;
        order: -1;
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid var(--wc-border);
    }
    
    .wc-col-qty:before {
        content: 'Quantidade' !important;
    }
    
    .wc-product-qty {
        width: 80px;
        padding: 0.625rem;
        font-size: 1rem;
    }
    
    .wc-col-product:before {
        content: 'Produto';
    }
    
    .wc-col-brand:before {
        content: 'Marca';
    }
    
    .wc-col-weight:before {
        content: 'Peso';
    }
    
    .wc-col-category:before {
        content: 'Categoria';
    }

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

    .wc-step-navigation {
        flex-direction: column;
    }

    .wc-btn {
        width: 100%;
        justify-content: center;
    }

    .wc-notification {
        left: 10px;
        right: 10px;
        min-width: auto;
    }
    
    .wc-floating-next {
        bottom: 15px;
        width: calc(100% - 30px);
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .wc-steps-order {
        padding: 0.75rem;
        margin: 0.5rem;
    }
    
    .wc-product-row {
        padding: 0.75rem;
    }
    
    .wc-products-table td {
        font-size: 0.875rem;
    }
    
    .wc-floating-next {
        bottom: 10px;
        width: calc(100% - 20px);
        padding: 0.875rem 1.25rem;
        font-size: 0.9375rem;
        border-radius: 40px;
    }
    
    .wc-floating-next svg {
        width: 20px;
        height: 20px;
    }
}
