/* ══════════════════════════════════════════════════
   PsycoPass — Components CSS
   ══════════════════════════════════════════════════ */

/* === Cards === */
.card-glass {
    background: var(--bg-glass);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.035);
    transition: transform var(--transition-spring), border-color var(--transition-base), box-shadow var(--transition-base);
}

.card-glass:hover {
    transform: translateY(-4px);
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

/* === Buttons === */
.btn-premium {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    font-weight: var(--fw-semibold);
    font-size: var(--fs-base);
    cursor: pointer;
    transition: all var(--transition-base);
    overflow: hidden;
    border: none;
    outline: none;
    text-decoration: none;
    min-height: 42px;
}

.btn-premium:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
    box-shadow: none !important;
}

.nav-direction-btn {
    direction: ltr;
}

.nav-direction-icon,
.nav-direction-text {
    unicode-bidi: isolate;
}

.nav-direction-icon {
    direction: ltr;
    line-height: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), #0369a1);
    color: #ffffff;
    box-shadow: 0 12px 28px rgba(14, 165, 233, 0.22);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-primary-hover), var(--color-primary));
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(14, 165, 233, 0.28), var(--shadow-glow);
}

.btn-accent {
    background: linear-gradient(135deg, var(--color-accent), #0891b2);
    color: var(--text-inverse);
    box-shadow: 0 4px 14px rgba(34, 211, 238, 0.3);
}

.btn-accent:hover {
    background: linear-gradient(135deg, var(--color-accent-hover), #06b6d4);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 211, 238, 0.5), var(--shadow-glow-accent);
}

.btn-secondary {
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.btn-secondary:hover {
    background: var(--bg-surface-active);
    border-color: var(--border-color-hover);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--sidebar-item-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--color-error);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
    background: #e11d48;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 63, 94, 0.5);
}

/* Shimmer/Reflection Effect */
.btn-premium::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 45%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 55%
    );
    transform: rotate(-45deg);
    transition: none;
    opacity: 0;
}

.btn-premium:hover::after {
    opacity: 1;
    transform: translate(50%, 50%) rotate(-45deg);
    transition: transform 800ms ease-out;
}

/* === Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    text-transform: uppercase;
}

/* Difficulty Badges */
.badge-easy {
    background: var(--color-success-light);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-medium {
    background: var(--color-info-light);
    color: var(--color-info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-hard {
    background: var(--color-warning-light);
    color: var(--color-warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-expert {
    background: var(--color-error-light);
    color: var(--color-error);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.badge-board-level {
    background: rgba(251, 191, 36, 0.15);
    color: var(--color-gold);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

/* === Form Inputs === */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: var(--fw-semibold);
    color: var(--text-secondary);
    font-size: var(--fs-sm);
}

.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    font-size: var(--fs-base);
    transition: border-color var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--bg-surface);
    box-shadow: 0 0 0 4px var(--color-primary-light);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .4s;
    border-radius: var(--radius-full);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--color-primary);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--color-primary);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* === Compact Action Buttons === */
.row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    flex-wrap: nowrap;
    white-space: nowrap;
}

.action-icon-btn {
    position: relative;
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0 !important;
    display: inline-grid;
    place-items: center;
    border-radius: var(--radius-md);
    line-height: 1;
    font-size: 1rem;
}

.action-icon-btn .action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* === Modals === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: var(--blur-sm);
    -webkit-backdrop-filter: var(--blur-sm);
    transform: scale(0.95);
    transition: transform var(--transition-spring);
    overflow: hidden;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.confirm-modal-container {
    max-width: min(92vw, 460px);
}

.modal-header {
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--divider);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: var(--space-6);
    color: var(--text-secondary);
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--divider);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    background: var(--bg-primary);
}

@media (max-width: 520px) {
    .modal-overlay {
        padding: var(--space-4);
        align-items: flex-end;
    }

    .modal-container {
        width: 100%;
        max-width: none;
    }

    .modal-footer {
        flex-direction: column-reverse;
        align-items: stretch;
    }
}

/* === Toast Notifications === */
.toast-container {
    position: fixed;
    bottom: var(--space-6);
    left: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    z-index: 1100;
}

[dir="rtl"] .toast-container {
    left: auto;
    right: var(--space-6);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    animation: slideIn 350ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.toast-success { border-left: 4px solid var(--color-success); }
.toast-error { border-left: 4px solid var(--color-error); }
.toast-warning { border-left: 4px solid var(--color-warning); }
.toast-info { border-left: 4px solid var(--color-info); }

[dir="rtl"] .toast-success { border-left: none; border-right: 4px solid var(--color-success); }
[dir="rtl"] .toast-error { border-left: none; border-right: 4px solid var(--color-error); }
[dir="rtl"] .toast-warning { border-left: none; border-right: 4px solid var(--color-warning); }
[dir="rtl"] .toast-info { border-left: none; border-right: 4px solid var(--color-info); }

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 640px) {
    .card-glass {
        max-width: 100%;
    }

    .card-glass:has(.premium-table) {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .premium-table {
        min-width: 620px;
    }

    .questions-list-card .premium-table {
        min-width: 0;
    }

    .btn-premium {
        white-space: normal;
        text-align: center;
    }

    .form-input,
    .form-select,
    select,
    textarea,
    input {
        max-width: 100%;
    }
}
