/**
 * Tokutei Exams - UI Components Styles
 *
 * Modern, accessible, and responsive component styles
 *
 * @since 2.0.0
 */

/* ==========================================
   MODAL COMPONENT
   ========================================== */

.te-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    animation: te-fade-in 0.2s ease;
}

@keyframes te-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.te-modal {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: te-slide-up 0.3s ease;
}

@keyframes te-slide-up {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.te-modal-small {
    width: 400px;
}

.te-modal-medium {
    width: 600px;
}

.te-modal-large {
    width: 900px;
}

.te-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.te-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.te-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.te-modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.te-modal-close:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.te-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.te-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Confirm Dialog Styles */
.te-confirm-dialog {
    text-align: center;
    padding: 20px 0;
}

.te-confirm-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.te-confirm-message {
    font-size: 16px;
    color: #374151;
    line-height: 1.5;
    margin: 0;
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */

.te-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.te-toast {
    background: #ffffff;
    padding: 14px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 500px;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: auto;
    border-left: 4px solid currentColor;
}

.te-toast.te-toast-show {
    opacity: 1;
    transform: translateX(0);
}

.te-toast-icon {
    font-size: 20px;
    font-weight: bold;
    flex-shrink: 0;
}

.te-toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
    color: #1f2937;
}

.te-toast-close {
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.te-toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Toast Types */
.te-toast-success {
    border-left-color: #10b981;
}

.te-toast-success .te-toast-icon {
    color: #10b981;
}

.te-toast-error {
    border-left-color: #ef4444;
}

.te-toast-error .te-toast-icon {
    color: #ef4444;
}

.te-toast-warning {
    border-left-color: #f59e0b;
}

.te-toast-warning .te-toast-icon {
    color: #f59e0b;
}

.te-toast-info {
    border-left-color: #3b82f6;
}

.te-toast-info .te-toast-icon {
    color: #3b82f6;
}

/* ==========================================
   LOADING COMPONENT
   ========================================== */

.te-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: te-fade-in 0.2s ease;
}

.te-loading-content {
    text-align: center;
}

.te-spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
    animation: te-spin 0.8s linear infinite;
}

@keyframes te-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.te-loading-text {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* Global Loading (Full Page) */
.te-loading-global {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    animation: te-fade-in 0.3s ease;
}

.te-spinner-large {
    border: 6px solid #f3f4f6;
    border-top: 6px solid #3b82f6;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    animation: te-spin 0.8s linear infinite;
}

/* ==========================================
   PROGRESS BAR
   ========================================== */

.te-progress-wrapper {
    width: 100%;
}

.te-progress-label {
    font-size: 14px;
    color: #374151;
    margin-bottom: 8px;
    font-weight: 500;
}

.te-progress-bar {
    background: #e5e7eb;
    border-radius: 8px;
    height: 24px;
    overflow: hidden;
    position: relative;
}

.te-progress-fill {
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    height: 100%;
    border-radius: 8px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.te-progress-text {
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
}

/* ==========================================
   BUTTONS
   ========================================== */

.te-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.te-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.te-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.te-btn-primary {
    background: #3b82f6;
    color: #ffffff;
}

.te-btn-primary:hover:not(:disabled) {
    background: #2563eb;
}

.te-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.te-btn-secondary:hover:not(:disabled) {
    background: #e5e7eb;
}

.te-btn-danger {
    background: #ef4444;
    color: #ffffff;
}

.te-btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.te-btn-success {
    background: #10b981;
    color: #ffffff;
}

.te-btn-success:hover:not(:disabled) {
    background: #059669;
}

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

@media (max-width: 768px) {
    .te-modal {
        max-width: 95%;
        margin: 10px;
    }

    .te-modal-small,
    .te-modal-medium,
    .te-modal-large {
        width: 100%;
    }

    .te-toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }

    .te-toast {
        min-width: 0;
        max-width: 100%;
    }

    .te-modal-header {
        padding: 16px;
    }

    .te-modal-body {
        padding: 16px;
    }

    .te-modal-footer {
        padding: 12px 16px;
        flex-direction: column-reverse;
    }

    .te-modal-footer .te-btn {
        width: 100%;
    }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */

/* Focus visible for keyboard navigation */
.te-modal-close:focus-visible,
.te-toast-close:focus-visible,
.te-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .te-modal-overlay,
    .te-modal,
    .te-toast,
    .te-loading-overlay,
    .te-progress-fill {
        animation: none;
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .te-modal {
        border: 2px solid currentColor;
    }

    .te-btn {
        border: 2px solid currentColor;
    }
}
