/* Glassmorphism */
.glass {
    background: #1e293b;
    border: 1px solid var(--border-color);
}

/* Loader */
.loader-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 600px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-color);
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(56, 189, 248, 0.1);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Buttons */
.primary-btn {
    width: 100%;
    padding: 11px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #075985, #0c4a6e);
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s, transform 0.1s;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
    position: relative;
    overflow: hidden;
}

.primary-btn:active {
    transform: scale(0.98);
}

.primary-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300%;
    height: 300%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%) scale(0);
    border-radius: 50%;
    transition: transform 0.5s;
}

.primary-btn:active::after {
    transform: translate(-50%, -50%) scale(1);
    transition: transform 0s;
}

.secondary-btn {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    min-width: 100px;
    justify-content: center;
}

.secondary-btn:active {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.95);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn:active {
    background: rgba(255, 255, 255, 0.1);
}


/* Cards */
.quiz-grid {
    display: grid;
    gap: 16px;
}

.quiz-card {
    position: relative;
    z-index: 2;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.2s ease-out, background 0.2s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.quiz-card:active {
    transform: scale(0.98);
}

.quiz-card-content {
    padding: 16px;
    flex-grow: 1;
}

.quiz-card h3 {
    font-size: 1.1rem;
    margin-bottom: 4px;
    overflow-wrap: break-word;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.quiz-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.quiz-card-actions {
    padding: 10px 16px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.15);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 400px) {
    .quiz-card-actions {
        grid-template-columns: 1fr;
    }

    .secondary-btn {
        padding: 12px;
    }
}

/* Swipe Actions */
.quiz-card-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    touch-action: pan-y;
    user-select: none;
    margin-bottom: 16px;
}

.quiz-card-swipe-actions {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1;
    border-radius: 16px;
    overflow: hidden;
    visibility: hidden;
}

.quiz-card-wrapper.swiping .quiz-card-swipe-actions,
.quiz-card-wrapper.active-swipe .quiz-card-swipe-actions {
    visibility: visible;
}

.swipe-action {
    width: 80px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.2rem;
    gap: 4px;
    position: relative;
    overflow: hidden;
}

.swipe-action:active {
    transform: scale(0.85);
    filter: brightness(1.2);
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple-animation 1.2s cubic-bezier(0.23, 1, 0.32, 1);
    pointer-events: none;
}

.action-download {
    background: linear-gradient(135deg, #0088cc, #00aaff);
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.1);
}

.action-delete {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.1);
}

.swipe-action span {
    font-size: 0.65rem;
    font-weight: 600;
}

.quiz-card.swiped-left {
    transform: translateX(-80px);
}

.quiz-card.swiped-right {
    transform: translateX(80px);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: #1e293b;
    width: 100%;
    max-width: 400px;
    border-radius: 24px;
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-header {
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    gap: 12px;
}

.confirm-yes,
.confirm-btn {
    flex: 2;
    background: var(--accent-color);
    border: none;
    color: white;
    padding: 12px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
}

.confirm-yes.danger {
    background: var(--danger-color);
}

.confirm-no,
.cancel-btn {
    flex: 1;
    background: #334155;
    border: 1px solid var(--border-color);
    color: #ffffff;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
}

.confirm-modal-content {
    text-align: center;
}

.confirm-icon {
    font-size: 3rem;
    margin-bottom: 5px;
    display: block;
}

.confirm-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: white;
}

.confirm-text {
    color: var(--text-muted);
    margin-bottom: 20px;
    overflow-wrap: break-word;
    word-break: break-all;
    white-space: pre-wrap;
}

/* Input Groups & Char Count */
.input-group {
    position: relative;
    width: 100%;
}

.char-count {
    position: absolute;
    right: 8px;
    bottom: 8px;
    font-size: 0.7rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 4px;
    border-radius: 4px;
    pointer-events: none;
}

.input-error {
    border-color: var(--danger-color) !important;
}

.char-count.error {
    color: var(--danger-color);
    font-weight: bold;
}
