/**
 * CNTEC Review Page Styles (Module 4)
 * 
 * Styling for editable cart review page and lead capture form
 * NO PRICES DISPLAYED - Price-free interface for LGPD compliance
 * 
 * @package CNTEC_Orcamento
 * @since 1.0.0
 */

/* ============================================
   REVIEW PAGE WRAPPER
   ============================================ */

.cntec-review-page-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ============================================
   CART SECTION
   ============================================ */

.cntec-review-cart-section {
    background: #ffffff;
    border-radius: 8px;
    padding: 32px;
    margin-bottom: 40px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.cntec-review-title {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 24px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.cntec-review-count {
    font-size: 18px;
    font-weight: 400;
    color: #666;
}

/* ============================================
   INLINE EDIT FOLDER (Cards Style)
   ============================================ */

.cntec-edit-folder {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.cntec-edit-cell {
    padding: 0;
}

.cntec-inline-edit-form {
    padding: 24px;
    background: #ffffff;
    border-left: 4px solid var(--cntec-primary, #2563eb);
    margin: 0;
}

.cntec-inline-edit-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
}

.cntec-inline-edit-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.cntec-inline-product-name {
    font-weight: 400;
    color: #6b7280;
    margin-left: 8px;
}

/* Inline Fields Grid */
.cntec-inline-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.cntec-inline-field {
    display: flex;
    flex-direction: column;
}

.cntec-inline-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.cntec-inline-color-select,
.cntec-inline-param-select,
.cntec-inline-quantity-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    color: #1a1a1a;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    transition: all 0.2s ease;
    background: #ffffff;
}

.cntec-inline-color-select:focus,
.cntec-inline-param-select:focus,
.cntec-inline-quantity-input:focus {
    outline: none;
    border-color: var(--cntec-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.cntec-inline-quantity-input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.cntec-inline-quantity-input[type="number"]::-webkit-outer-spin-button,
.cntec-inline-quantity-input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Inline Actions */
.cntec-inline-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.cntec-inline-confirm-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    background: var(--cntec-primary, #2563eb);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cntec-inline-confirm-btn:hover {
    background: var(--cntec-primary-dark, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.cntec-inline-confirm-btn:active {
    transform: translateY(0);
}

.cntec-inline-confirm-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.cntec-inline-cancel-btn {
    flex: 0 0 auto;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #6b7280;
    background: #f3f4f6;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cntec-inline-cancel-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

/* Responsive */
@media (max-width: 767px) {
    .cntec-inline-fields-grid {
        grid-template-columns: 1fr;
    }
    
    .cntec-inline-actions {
        flex-direction: column;
    }
    
    .cntec-inline-confirm-btn,
    .cntec-inline-cancel-btn {
        width: 100%;
    }
}

/* ============================================
   EMPTY STATE
   ============================================ */

.cntec-review-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.cntec-review-empty-icon {
    width: 64px;
    height: 64px;
    color: #d1d5db;
    margin: 0 auto 24px;
    display: block;
}

.cntec-review-empty-message {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 8px 0;
}

.cntec-review-empty-hint {
    font-size: 16px;
    color: #6b7280;
    margin: 0;
}

/* ============================================
   REVIEW CARDS CONTAINER
   ============================================ */

.cntec-review-table-wrapper {
    max-height: 60vh; /* ✅ UX: Prevent page break */
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    padding: 16px;
}

/* Scrollbar styling */
.cntec-review-table-wrapper::-webkit-scrollbar {
    width: 8px;
}

.cntec-review-table-wrapper::-webkit-scrollbar-track {
    background: #f9fafb;
}

.cntec-review-table-wrapper::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.cntec-review-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ============================================
   REVIEW CARDS
   ============================================ */

.cntec-review-row {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    gap: 20px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.cntec-review-row:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Loading states */
.cntec-review-row.is-updating-quantity {
    background: #fffbeb;
    border-color: #f59e0b;
}

.cntec-review-row.is-removing {
    opacity: 0.6;
    background: #fef2f2;
    border-color: #ef4444;
    pointer-events: none;
}

/* ✅ UX: Flash animation after attribute update */
.cntec-review-row.updated-flash {
    animation: flash-row 2s ease;
}

@keyframes flash-row {
    0%, 100% { background: #ffffff; }
    50% { background: #f0fdf4; }
}

/* ============================================
   CARD SECTIONS
   ============================================ */

/* Item Number */
.cntec-review-td-number {
    flex-shrink: 0;
    width: 40px;
}

.cntec-review-item-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #f3f4f6;
    color: #374151;
    font-size: 16px;
    font-weight: 700;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
}

/* Product Section */
.cntec-review-td-product {
    flex: 1;
    min-width: 0;
}

.cntec-review-product-name {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
    margin-bottom: 4px;
}

/* Attributes Section */
.cntec-review-td-attributes {
    flex: 1;
    max-width: 200px;
    font-size: 14px;
    color: #6b7280;
}

.cntec-review-attribute {
    display: block;
    margin-bottom: 4px;
    line-height: 1.4;
}

.cntec-review-attribute:last-child {
    margin-bottom: 0;
}

.cntec-review-attribute strong {
    color: #374151;
    font-weight: 600;
}

/* Quantity Section */
.cntec-review-td-quantity {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    max-width: 100px;
}

.cntec-review-quantity-input {
    width: 80px;
    padding: 10px 12px;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    transition: all 0.2s ease;
    background: #ffffff;
}

.cntec-review-quantity-input:focus {
    outline: none;
    border-color: var(--cntec-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.cntec-review-quantity-input.is-updating {
    border-color: #f59e0b;
    background: #fffbeb;
    animation: flash-success 1s ease;
}

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

/* ============================================
   ACTIONS GROUP
   ============================================ */

.cntec-review-actions-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Actions Section */
.cntec-review-td-actions {
    flex-shrink: 0;
}

.cntec-review-actions-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Edit Button (Primary) */
.cntec-review-edit-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--cntec-primary, #2563eb);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cntec-review-edit-btn:hover {
    background: var(--cntec-primary-dark, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.cntec-review-edit-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.cntec-review-edit-btn .cntec-btn-text {
    white-space: nowrap;
}

/* Remove Button (Secondary) */
.cntec-review-remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cntec-review-remove-btn:hover {
    border-color: #ef4444;
    background: #ef4444;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.cntec-review-remove-btn svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* ============================================
   RESPONSIVE DESIGN - MOBILE
   ============================================ */

@media (max-width: 768px) {
    .cntec-review-page-wrapper {
        padding: 24px 16px;
    }
    
    .cntec-review-cart-section {
        padding: 24px;
        margin-bottom: 32px;
    }
    
    .cntec-review-title {
        font-size: 24px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    /* Mobile Cards Layout */
    .cntec-review-table-wrapper {
        padding: 12px;
    }
    
    .cntec-review-row {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 16px;
    }
    
    /* Mobile Card Header */
    .cntec-review-td-number,
    .cntec-review-td-product {
        display: flex;
        align-items: center;
        gap: 12px;
    }
    
    .cntec-review-td-number {
        width: auto;
        flex-shrink: 0;
    }
    
    .cntec-review-item-number {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .cntec-review-product-name {
        font-size: 16px;
        margin-bottom: 0;
    }
    
    /* Mobile Card Body */
    .cntec-review-td-attributes {
        order: 1;
        font-size: 13px;
    }
    
    .cntec-review-td-quantity {
        order: 2;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        min-width: auto;
        padding: 12px;
        background: #f9fafb;
        border-radius: 6px;
    }
    
    .cntec-review-quantity-input {
        width: 70px;
    }
    
    /* Mobile Actions */
    .cntec-review-td-actions {
        order: 3;
    }
    
    .cntec-review-actions-group {
        justify-content: stretch;
        gap: 8px;
    }
    
    .cntec-review-edit-btn {
        flex: 1;
        justify-content: center;
        padding: 12px 16px;
    }
    
    .cntec-review-remove-btn {
        width: 44px;
        height: 44px;
    }
    
    /* Mobile Forms */
    .cntec-lead-form-section {
        padding: 24px;
    }
    
    .cntec-lead-form-title {
        font-size: 24px;
    }
    
    .cntec-form-row {
        flex-direction: column;
        gap: 16px;
    }
    
    .cntec-form-field-half {
        width: 100%;
    }
}

@media (max-width: 479px) {
    .cntec-review-cart-section,
    .cntec-lead-form-section {
        padding: 20px 16px;
        border-radius: 0;
    }
    
    .cntec-review-empty {
        padding: 60px 16px;
    }
    
    .cntec-review-empty-icon {
        width: 48px;
        height: 48px;
    }
    
    .cntec-form-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* ============================================
   LEAD FORM SECTION
   ============================================ */

.cntec-lead-form-section {
    background: #ffffff;
    border-radius: 8px;
    padding: 32px;
    margin-top: 40px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.cntec-lead-form-title {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px 0;
    line-height: 1.2;
}

.cntec-lead-form-description {
    font-size: 16px;
    color: #6b7280;
    margin: 0 0 32px 0;
    line-height: 1.5;
}

/* ============================================
   LEAD FORM LAYOUT
   ============================================ */

.cntec-lead-form {
    display: grid;
    gap: 20px;
    max-width: 600px;
    margin: 0;
    
}

.cntec-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

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

.cntec-form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cntec-form-field-full {
    grid-column: 1 / -1;
}

.cntec-form-field-half {
    /* Grid item - inherits parent grid behavior */
    display: flex;
    flex-direction: column;
}

/* ============================================
   FORM TYPOGRAPHY
   ============================================ */

.cntec-form-label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    line-height: 1.4;
    margin: 0;
}

.cntec-required {
    color: #ef4444;
    font-weight: 700;
}

/* ============================================
   FORM INPUTS
   ============================================ */

.cntec-form-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 400;
    color: #1a1a1a;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.cntec-form-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.cntec-form-input:focus {
    outline: none;
    border-color: var(--cntec-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: #ffffff;
}

.cntec-form-input:hover {
    border-color: #d1d5db;
}

/* ============================================
   CHECKBOX STYLING
   ============================================ */

.cntec-form-field-checkbox {
    margin: 16px 0;
    grid-column: 1 / -1;
    width: 100%;
}

/* ============================================
   OBSERVATIONS FIELD (Toggle)
   ============================================ */

.cntec-observations-wrapper {
    margin-top: 8px;
}

.cntec-toggle-observations-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    border: 2px dashed #d1d5db;
    border-radius: 6px;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cntec-toggle-observations-btn:hover {
    border-color: var(--cntec-primary, #2563eb);
    color: var(--cntec-primary, #2563eb);
    background: rgba(37, 99, 235, 0.05);
}

.cntec-toggle-observations-btn.is-active {
    border-style: solid;
    border-color: var(--cntec-primary, #2563eb);
    color: var(--cntec-primary, #2563eb);
    background: rgba(37, 99, 235, 0.05);
}

.cntec-toggle-observations-btn.is-active .cntec-toggle-icon {
    transform: rotate(45deg);
}

.cntec-toggle-icon {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.cntec-observations-field {
    margin-top: 12px;
    animation: slideDown 0.3s ease;
}

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

.cntec-form-textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.cntec-optional {
    color: #9ca3af;
    font-weight: 400;
    font-size: 13px;
}

.cntec-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    color: #374151;
}

.cntec-checkbox-input {
    width: 18px;
    height: 18px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--cntec-primary, #2563eb);
    cursor: pointer;
}

.cntec-checkbox-text {
    flex: 1;
}

.cntec-checkbox-text a {
    color: var(--cntec-primary, #2563eb);
    text-decoration: none;
    font-weight: 600;
}

.cntec-checkbox-text a:hover {
    text-decoration: underline;
}

/* ============================================
   SUBMIT BUTTON
   ============================================ */

.cntec-lead-submit-btn {
    width: 100%;
    padding: 16px 24px;
    background: var(--cntec-primary, #2563eb);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.cntec-lead-submit-btn:hover {
    background: var(--cntec-primary-dark, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.cntec-lead-submit-btn:active {
    transform: translateY(0);
}

.cntec-lead-submit-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.cntec-lead-submit-btn .cntec-btn-text {
    flex: 1;
}

.cntec-lead-submit-btn .cntec-btn-loader {
    display: none;
}

.cntec-lead-submit-btn.loading .cntec-btn-text {
    display: none;
}

.cntec-lead-submit-btn.loading .cntec-btn-loader {
    display: block;
}

/* ============================================
   MOBILE OVERRIDES FOR LEAD FORM
   ============================================ */

@media (max-width: 768px) {
    .cntec-form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .cntec-form-field-half {
        width: 100%;
    }
    
    .cntec-lead-form-section {
        padding: 24px;
    }
    
    .cntec-lead-form-title {
        font-size: 24px;
    }
}
