/**
 * Card2Code Checkout Styles
 */

/* Modal Overlay */
.c2c-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: c2c-fadeIn 0.2s ease;
}

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

/* Modal Content */
.c2c-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.95);
    transition: transform 0.2s ease;
    z-index: 1;
}

/* Modal Header */
.c2c-modal-header {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 24px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2;
}

.c2c-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    padding-right: 30px;
}

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

.c2c-modal-close:hover,
.c2c-modal-close:focus {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Modal Body */
.c2c-modal-body {
    padding: 24px;
}

.c2c-instructions {
    margin-bottom: 24px;
}

.c2c-instructions ol {
    margin: 0;
    padding-left: 20px;
}

.c2c-instructions li {
    margin-bottom: 12px;
    line-height: 1.6;
    color: #333;
}

.c2c-instructions li:last-child {
    margin-bottom: 0;
}

/* Actions */
.c2c-actions {
    margin-bottom: 24px;
}

/* Buttons */
.c2c-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.c2c-button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.c2c-button-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    width: 100%;
    justify-content: center;
}

.c2c-button-primary:hover,
.c2c-button-primary:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.c2c-button-primary svg {
    width: 18px;
    height: 18px;
}

.c2c-button-success {
    background: #10b981;
    color: #fff;
}

.c2c-button-success:hover:not(:disabled),
.c2c-button-success:focus:not(:disabled) {
    background: #059669;
}

.c2c-button-success:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.c2c-button-secondary {
    background: #e5e7eb;
    color: #374151;
}

.c2c-button-secondary:hover,
.c2c-button-secondary:focus {
    background: #d1d5db;
}

/* Code Input */
.c2c-code-input-wrapper {
    margin-bottom: 24px;
}

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

.c2c-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    font-size: 15px;
    font-family: 'Courier New', monospace;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.c2c-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.c2c-input-error {
    border-color: #ef4444;
}

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

.c2c-error-message {
    display: block;
    color: #ef4444;
    font-size: 13px;
    margin-top: 6px;
}

/* Modal Footer */
.c2c-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.c2c-modal-footer .c2c-button {
    flex: 1;
    min-width: 140px;
    justify-content: center;
}

/* Checkout Fields */
.c2c-checkout-fields {
    margin: 16px 0;
}

.c2c-code-status {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 6px;
    padding: 12px;
    margin: 12px 0;
}

.c2c-code-label {
    font-weight: 600;
    color: #166534;
}

.c2c-code-status code {
    background: #dcfce7;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #166534;
    font-size: 14px;
}

.c2c-help-link-wrapper {
    margin: 12px 0;
}

.c2c-need-help-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.c2c-need-help-link:hover,
.c2c-need-help-link:focus {
    color: #764ba2;
    text-decoration: underline;
}

/* Notification Toast */
.c2c-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1f2937;
    color: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 1000000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.c2c-notification-show {
    opacity: 1;
    transform: translateY(0);
}

/* Animations */
@keyframes c2c-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .c2c-modal-content {
        width: 95%;
        max-height: 95vh;
        border-radius: 8px;
    }

    .c2c-modal-header {
        padding: 20px;
        border-radius: 8px 8px 0 0;
    }

    .c2c-modal-header h2 {
        font-size: 18px;
        padding-right: 40px;
    }

    .c2c-modal-close {
        width: 32px;
        height: 32px;
        font-size: 24px;
        top: 16px;
        right: 16px;
    }

    .c2c-modal-body {
        padding: 20px;
    }

    .c2c-modal-footer {
        padding: 16px 20px;
        flex-direction: column;
    }

    .c2c-modal-footer .c2c-button {
        width: 100%;
    }

    .c2c-notification {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }
}

@media (max-width: 480px) {
    .c2c-modal-header h2 {
        font-size: 16px;
    }

    .c2c-button {
        padding: 10px 20px;
        font-size: 14px;
    }

    .c2c-input {
        font-size: 14px;
        padding: 10px 14px;
    }
}

/* Loading State */
.c2c-button.c2c-loading {
    position: relative;
    color: transparent;
}

.c2c-button.c2c-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: c2c-spin 0.6s linear infinite;
}

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

/* Focus Visible for Accessibility */
.c2c-modal *:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .c2c-modal-overlay {
        background-color: rgba(0, 0, 0, 0.85);
    }

    .c2c-input {
        border-width: 3px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .c2c-modal,
    .c2c-modal-content,
    .c2c-button,
    .c2c-notification,
    .c2c-modal-close {
        animation: none;
        transition: none;
    }

    .c2c-modal-close:hover {
        transform: none;
    }
}
