/**
 * FORDIPS TECH - Enhanced Checkout Styles
 * Additional styles for checkout validation and UX
 */

/* ===== FORM VALIDATION STYLES ===== */
.form-group input.error,
.form-group select.error {
    border-color: #ef4444 !important;
    background-color: #fef2f2;
}

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

.form-group input.error:focus,
.form-group select.error:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.field-error {
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.field-error::before {
    content: "⚠";
    font-size: 14px;
}

/* ===== ENHANCED PAYMENT OPTIONS ===== */
.payment-methods {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.payment-option {
    position: relative;
    cursor: pointer;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s;
    background: white;
    display: block;
}

.payment-option:hover {
    border-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.payment-option.selected {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.payment-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.payment-option-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.payment-icon {
    font-size: 28px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border-radius: 8px;
}

.payment-option.selected .payment-icon {
    background: white;
}

/* Payment Logo Styles */
.payment-logo-single {
    width: 50px;
    height: 50px;
    object-fit: contain;
    background: white;
    padding: 6px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.payment-logo-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.payment-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    background: white;
    padding: 4px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.payment-option.selected .payment-logo-single,
.payment-option.selected .payment-logo {
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.payment-option:hover .payment-logo-single,
.payment-option:hover .payment-logo {
    transform: scale(1.05);
    transition: transform 0.2s;
}

.payment-option-content strong {
    font-size: 14px;
    color: #1e293b;
    display: block;
    font-weight: 600;
}

.payment-option-content small {
    font-size: 12px;
    color: #64748b;
    display: block;
}

/* ===== CHECKOUT MODAL ENHANCEMENTS ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
    padding: 32px;
    animation: modalFadeIn 0.3s ease;
}

.modal-content.modal-large {
    max-width: 900px;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    color: #333;
    font-size: 24px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

.checkout-content h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 24px 0;
}

.checkout-section {
    margin-bottom: 32px;
}

.checkout-section h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #334155;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: #1e293b;
    color: #94a3b8;
    transition: all 0.35s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #64748b;
    opacity: 1;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: #475569;
}

/* Active state - white background when focused or has value */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-group input:not(:placeholder-shown),
.form-group textarea:not(:placeholder-shown) {
    background: #ffffff;
    color: #1e293b;
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
    outline: none;
}

.form-group input:focus::placeholder,
.form-group textarea:focus::placeholder {
    color: #94a3b8;
}

/* For select elements (they don't support :placeholder-shown) */
.form-group select:focus,
.form-group select:valid:not([value=""]) {
    background: #ffffff;
    color: #1e293b;
    border-color: #2563eb;
}

.checkout-summary {
    background: #f8fafc;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.checkout-summary h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 16px 0;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 15px;
    color: #475569;
}

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

.summary-row.total {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    padding-top: 16px;
    margin-top: 8px;
    border-top: 2px solid #cbd5e1;
}

.btn-full {
    width: 100%;
}

/* ===== BUTTON STYLES ===== */
.btn {
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-outline {
    background: white;
    color: #2563eb;
    border: 2px solid #2563eb;
}

.btn-outline:hover {
    background: #eff6ff;
}

/* ===== EMPTY CART STATE ===== */
.empty-cart-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-cart-state svg {
    opacity: 0.3;
    margin-bottom: 20px;
}

.empty-cart {
    font-size: 18px;
    color: #64748b;
    margin: 16px 0;
    font-weight: 500;
}

.btn-start-shopping {
    padding: 12px 32px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    margin-top: 16px;
    display: inline-block;
    transition: all 0.2s;
}

.btn-start-shopping:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

/* ===== THANK YOU MODAL STYLES ===== */
.thank-you-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
}

.thank-you-modal.active {
    display: flex;
}

.thank-you-content {
    position: relative;
    background: white;
    border-radius: 20px;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
    padding: 48px;
    text-align: center;
    animation: modalFadeIn 0.4s ease;
}

.thank-you-icon {
    margin: 0 auto 24px;
    animation: scaleIn 0.5s ease 0.2s both;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.thank-you-content h2 {
    font-size: 32px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 16px 0;
}

.thank-you-message {
    font-size: 16px;
    color: #64748b;
    margin-bottom: 32px;
}

.order-summary-box {
    background: #f8fafc;
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
    text-align: left;
}

.order-summary-box .summary-row {
    padding: 12px 0;
}

.order-number,
.tracking-number,
.order-total {
    color: #2563eb;
    font-family: 'Courier New', monospace;
}

.order-items-summary {
    margin: 24px 0;
    text-align: left;
}

.order-items-summary h4 {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 16px;
}

.thank-you-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 8px;
}

.thank-you-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

.thank-you-item-info {
    flex: 1;
    text-align: left;
}

.thank-you-item-info strong {
    display: block;
    font-size: 14px;
    color: #1e293b;
    margin-bottom: 4px;
}

.thank-you-item-info p {
    font-size: 12px;
    color: #64748b;
    margin: 0;
}

.thank-you-item-total {
    font-weight: 700;
    color: #2563eb;
}

.confirmation-info {
    background: #eff6ff;
    border-radius: 12px;
    padding: 20px;
    margin: 24px 0;
}

.confirmation-info p {
    font-size: 14px;
    color: #475569;
    margin: 8px 0;
}

.next-steps {
    background: #f1f5f9;
    border-radius: 12px;
    padding: 20px;
    text-align: left;
    margin: 24px 0;
}

.next-steps h4 {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 12px 0;
}

.next-steps ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.next-steps li {
    padding: 8px 0;
    font-size: 14px;
    color: #475569;
}

.thank-you-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    justify-content: center;
}

@media (max-width: 640px) {
    .thank-you-actions {
        flex-direction: column;
    }

    .thank-you-content {
        padding: 32px 24px;
    }

    .modal-content {
        width: 95%;
        padding: 24px;
    }
}

/* ===== RESPONSIVE SCROLLBAR ===== */
.modal-content::-webkit-scrollbar,
.thank-you-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track,
.thank-you-content::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.modal-content::-webkit-scrollbar-thumb,
.thank-you-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover,
.thank-you-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ===== TRUST BADGES ===== */
.trust-badges {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(44, 169, 161, 0.05) 0%, rgba(99, 102, 241, 0.05) 100%);
    border-radius: var(--radius-md);
    border: 2px solid rgba(44, 169, 161, 0.1);
}

.trust-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all var(--transition-normal);
}

.trust-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(44, 169, 161, 0.15);
}

.trust-badge svg {
    flex-shrink: 0;
    color: var(--primary);
    filter: drop-shadow(0 2px 4px rgba(44, 169, 161, 0.2));
}

.trust-badge div {
    flex: 1;
    min-width: 0;
}

.trust-badge strong {
    display: block;
    color: var(--gray-900);
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 2px;
}

.trust-badge small {
    display: block;
    color: var(--gray-600);
    font-size: 0.75rem;
    line-height: 1.2;
}

/* Mobile Responsive Trust Badges */
@media (max-width: 768px) {
    .trust-badges {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        padding: 1rem;
    }

    .trust-badge {
        padding: 0.6rem;
        gap: 0.6rem;
    }

    .trust-badge svg {
        width: 24px;
        height: 24px;
    }

    .trust-badge strong {
        font-size: 0.8rem;
    }

    .trust-badge small {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .trust-badges {
        grid-template-columns: 1fr 1fr;
    }

    .trust-badge {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .trust-badge svg {
        width: 28px;
        height: 28px;
    }
}

/* ===== SHIPPING OPTIONS STYLES ===== */
.shipping-options-section {
    margin: 1.5rem 0;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.shipping-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shipping-option {
    position: relative;
    cursor: pointer;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s;
    background: white;
    display: block;
}

.shipping-option:hover {
    border-color: #2ca9a1;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(44, 169, 161, 0.1);
}

.shipping-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.shipping-option input[type="radio"]:checked + .shipping-option-content {
    border-left: 4px solid #2ca9a1;
}

.shipping-option input[type="radio"]:checked ~ * {
    background: #f0fdfa;
}

.shipping-option:has(input[type="radio"]:checked) {
    border-color: #2ca9a1;
    background: #f0fdfa;
    box-shadow: 0 2px 8px rgba(44, 169, 161, 0.15);
}

.shipping-option-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.shipping-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.shipping-info strong {
    font-size: 1rem;
    color: #1e293b;
    font-weight: 600;
}

.shipping-info small {
    font-size: 0.85rem;
    color: #64748b;
}

.shipping-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2ca9a1;
    white-space: nowrap;
}

/* ===== MOBILE CHECKOUT IMPROVEMENTS ===== */
@media (max-width: 768px) {
    /* Modal content should fill screen better on mobile */
    .modal-content.modal-large {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
        overflow-y: auto;
    }

    .checkout-content {
        padding: 1rem;
    }

    .checkout-content h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .checkout-section {
        margin-bottom: 1.5rem;
    }

    .checkout-section h3 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    /* Payment methods - stack on mobile */
    .payment-methods {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .payment-option {
        padding: 12px;
    }

    .payment-option-content {
        gap: 10px;
    }

    .payment-logo-single {
        width: 40px;
        height: auto;
    }

    .payment-logo {
        width: 35px;
        height: auto;
    }

    .payment-icon {
        width: 35px;
        height: 35px;
        font-size: 24px;
    }

    .payment-option strong {
        font-size: 0.95rem;
    }

    .payment-option small {
        font-size: 0.8rem;
    }

    /* Shipping options mobile */
    .shipping-options-section {
        padding: 0.75rem;
    }

    .shipping-option {
        padding: 12px;
    }

    .shipping-option-content {
        flex-direction: row;
        gap: 8px;
    }

    .shipping-info strong {
        font-size: 0.95rem;
    }

    .shipping-info small {
        font-size: 0.8rem;
    }

    .shipping-price {
        font-size: 1rem;
    }

    /* Checkout summary mobile */
    .checkout-summary {
        padding: 16px;
        margin-bottom: 16px;
    }

    .summary-row {
        padding: 10px 0;
        font-size: 0.95rem;
    }

    .summary-row.total {
        font-size: 1.1rem;
    }

    /* Buttons mobile */
    .btn-place-order,
    .btn-help-me-pay {
        padding: 14px 20px;
        font-size: 1rem;
    }

    .btn-place-order svg,
    .btn-help-me-pay svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    .checkout-content {
        padding: 0.75rem;
    }

    .checkout-content h2 {
        font-size: 1.25rem;
    }

    .checkout-section h3 {
        font-size: 1rem;
    }

    /* Make form inputs more touch-friendly */
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 14px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    /* Payment methods even more compact */
    .payment-option {
        padding: 10px;
    }

    .payment-logo-single {
        width: 35px;
    }

    .payment-logo {
        width: 30px;
    }

    .payment-option strong {
        font-size: 0.9rem;
    }

    .payment-option small {
        font-size: 0.75rem;
    }

    /* Shipping options compact */
    .shipping-option {
        padding: 10px;
    }

    .shipping-info strong {
        font-size: 0.9rem;
    }

    .shipping-info small {
        font-size: 0.75rem;
    }

    .shipping-price {
        font-size: 0.95rem;
    }

    /* Trust badges smaller on very small screens */
    .trust-badges {
        gap: 0.5rem;
    }

    .trust-badge svg {
        width: 24px;
        height: 24px;
    }

    .trust-badge strong {
        font-size: 0.75rem;
    }

    .trust-badge small {
        font-size: 0.65rem;
    }
}
