/**
 * Cancellation Modal Styles
 * Issue #63: Cancellation UI with Error Boundaries
 *
 * Comprehensive styling for the cancellation modal with theme consistency,
 * responsive design, and accessibility considerations.
 */

/* Base Modal Container */
.cancellation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    font-family: inherit;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cancellation-modal.is-open {
    display: block;
    opacity: 1;
}

/* Modal Backdrop */
.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.cancellation-modal.is-open .modal-backdrop {
    opacity: 1;
}

/* Modal Container */
.modal-container {
    position: relative;
    background: #0A0B1A;
    color: #64FFDA;
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 12px;
    max-width: 600px;
    margin: 50px auto;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.8),
        0 10px 10px -5px rgba(0, 0, 0, 0.6);
    outline: none;
}

.cancellation-modal.is-open .modal-container {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Modal Header */
.modal-header {
    padding: 24px;
    border-bottom: 1px solid rgba(100, 255, 218, 0.2);
    position: relative;
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #64FFDA;
    line-height: 1.4;
    padding-right: 40px;
}

/* Modal Close Button */
.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64FFDA;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.modal-close:hover {
    background: rgba(10, 11, 26, 0.1);
    transform: scale(1.1);
}

.modal-close:focus {
    outline: 2px solid #0A0B1A;
    outline-offset: 2px;
}

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

.modal-description {
    margin-bottom: 20px;
    color: #CCD6F6;
}

/* Features Comparison Table */
.features-comparison {
    margin: 20px 0;
}

.features-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(100, 255, 218, 0.05);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.features-table th,
.features-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid rgba(100, 255, 218, 0.1);
    color: #CCD6F6;
}

.features-table th {
    background: rgba(100, 255, 218, 0.1);
    font-weight: 600;
    color: #64FFDA;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.features-table td {
    font-size: 1rem;
    color: #CCD6F6;
}

.features-table tr:last-child td {
    border-bottom: none;
}

.features-table tr:hover {
    background: rgba(100, 255, 218, 0.1);
}

/* Feature highlights */
.features-table td:nth-child(3) {
    font-weight: 600;
    color: #64FFDA;
}

.features-table td:nth-child(2) {
    color: #8892B0;
}

/* Error Message */
.error-message {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    background: #ef4444;
    color: white;
    font-size: 0.875rem;
    display: none;
    animation: slideIn 0.3s ease;
}

.error-message.show {
    display: block;
}

.error-message.success {
    background: #22c55e;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.btn:hover:before {
    width: 300px;
    height: 300px;
}

.btn-cancel {
    background: #0A0B1A;
    color: #64FFDA;
}

.btn-cancel:hover {
    background: #1a1b2a;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(10, 11, 26, 0.3);
}

.btn-manage {
    background: #0A0B1A;
    color: #64FFDA;
}

.btn-manage:hover {
    background: #1a1b2a;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(10, 11, 26, 0.3);
}

.btn-confirm {
    background: #ef4444;
    color: white;
}

.btn-confirm:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn:disabled:before {
    display: none;
}

/* Focus styles for accessibility */
.btn:focus {
    outline: 2px solid #0A0B1A;
    outline-offset: 2px;
}

/* Loading state */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading:after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.8s linear infinite;
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

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

    .modal-header {
        padding: 20px;
    }

    .modal-title {
        font-size: 1.125rem;
        padding-right: 36px;
    }

    .modal-body {
        padding: 20px;
    }

    .features-table {
        font-size: 0.875rem;
    }

    .features-table th,
    .features-table td {
        padding: 12px 8px;
    }

    .modal-actions {
        flex-direction: column;
        gap: 8px;
    }

    .btn {
        width: 100%;
        padding: 14px 20px;
    }

    .modal-close {
        top: 16px;
        right: 16px;
        width: 28px;
        height: 28px;
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .modal-container {
        margin: 16px;
        border-radius: 6px;
    }

    .modal-header {
        padding: 16px;
    }

    .modal-title {
        font-size: 1rem;
    }

    .modal-body {
        padding: 16px;
    }

    .features-table th,
    .features-table td {
        padding: 8px 6px;
        font-size: 0.813rem;
    }

    .modal-actions {
        margin-top: 16px;
    }

    .btn {
        padding: 12px 16px;
        font-size: 0.813rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .modal-container {
        border: 2px solid #0A0B1A;
    }

    .modal-close {
        border: 2px solid #0A0B1A;
    }

    .btn {
        border: 2px solid currentColor;
    }

    .features-table th {
        border-bottom: 2px solid #0A0B1A;
    }

    .features-table td {
        border-bottom: 1px solid #0A0B1A;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .cancellation-modal,
    .modal-backdrop,
    .modal-container,
    .btn,
    .error-message {
        transition: none;
        animation: none;
    }

    .btn:before {
        display: none;
    }
}

/* Focus visible for better keyboard navigation */
.btn:focus-visible {
    outline: 3px solid #0A0B1A;
    outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Loading overlay for modal */
.modal-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(100, 255, 218, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 10;
    display: none;
}

.modal-loading-overlay.show {
    display: flex;
}

/* Success state styling */
.modal-container.success {
    border: 2px solid #22c55e;
}

/* Error state styling */
.modal-container.error {
    border: 2px solid #ef4444;
}

/* Print styles */
@media print {
    .cancellation-modal {
        display: none !important;
    }
}