/**
 * Study Now Modal Styles - Premium Design
 * Matches the AI Amália page design language
 */

/* Modal overlay - covers entire screen with dimmed background */
.pbd-study-modal-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(38, 57, 110, 0.95) 0%, rgba(48, 73, 133, 0.92) 100%);
    backdrop-filter: blur(8px);
    z-index: 9998;
    animation: fadeIn 0.3s ease-out;
}

.pbd-study-modal-overlay.active {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Modal container */
.pbd-study-modal {
    position: relative;
    background: #ffffff;
    border-radius: 0;
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    z-index: 9999;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Modal header */
.pbd-study-modal-header {
    padding: 32px 32px 20px 32px;
    border-bottom: 2px solid #f0f4f8;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: linear-gradient(180deg, #fafbfc 0%, #ffffff 100%);
    border-radius: 0;
}

.pbd-study-modal-title {
    font-size: 26px;
    font-weight: 700;
    color: #1a2744;
    margin: 0;
    padding-right: 50px;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.pbd-study-modal-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    font-size: 24px;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 300;
}

.pbd-study-modal-close:hover {
    background: #ef4444;
    border-color: #dc2626;
    color: #ffffff;
    transform: rotate(90deg) scale(1.05);
}

/* Modal body */
.pbd-study-modal-body {
    padding: 32px;
    background: #ffffff;
}

/* Study options container */
.pbd-study-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* Study option card */
.pbd-study-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 24px;
    border: 2px solid #e8eef5;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff;
    position: relative;
    overflow: hidden;
    min-height: 280px;
}

.pbd-study-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(59, 82, 246, 0.05) 0%, rgba(99, 102, 241, 0.08) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pbd-study-option:hover {
    border-color: #3b4e96;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(38, 57, 110, 0.25);
}

.pbd-study-option:hover::before {
    opacity: 1;
}

.pbd-study-option:active {
    transform: translateY(-2px);
}

/* Study option icon/image */
.pbd-study-option-icon {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef2f7 0%, #dce4ed 100%);
    border-radius: 0;
    font-size: 40px;
    position: relative;
    z-index: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 16px rgba(38, 57, 110, 0.1);
}

.pbd-study-option:hover .pbd-study-option-icon {
    background: linear-gradient(135deg, #3b4e96 0%, #2d3e7a 100%);
    transform: scale(1.08) translateY(-4px);
    box-shadow: 0 12px 28px rgba(38, 57, 110, 0.25);
}

/* Amália character image */
.pbd-study-option-image {
    width: 120px;
    height: 120px;
    margin: 0 auto 16px;
    position: relative;
    z-index: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pbd-study-option-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 8px 20px rgba(38, 57, 110, 0.15));
}

.pbd-study-option:hover .pbd-study-option-image {
    transform: scale(1.05) translateY(-6px);
}

.pbd-study-option:hover .pbd-study-option-image img {
    filter: drop-shadow(0 12px 32px rgba(38, 57, 110, 0.25));
}

/* Study option content */
.pbd-study-option-content {
    flex: 1;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.pbd-study-option-label {
    font-size: 22px;
    font-weight: 700;
    color: #1a2744;
    margin: 0 0 10px 0;
    letter-spacing: -0.01em;
    transition: color 0.2s ease;
}

.pbd-study-option:hover .pbd-study-option-label {
    color: #2d3e7a;
}

.pbd-study-option-subtitle {
    font-size: 14px;
    font-weight: 600;
    color: #3b82f6;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.pbd-study-option-description {
    font-size: 15px;
    color: #64748b;
    margin: 0;
    line-height: 1.6;
    max-width: 220px;
}

.pbd-study-option-meta {
    font-size: 14px;
    color: #94a3b8;
    margin-top: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(59, 130, 246, 0.08);
    border-radius: 0;
}

.pbd-study-option-meta::before {
    content: '●';
    color: #3b82f6;
    font-size: 8px;
}

/* Feature list in study options */
.pbd-study-option-features {
    list-style: none;
    padding: 0;
    margin: 15px 0 0 0;
    text-align: left;
    width: 100%;
}

.pbd-study-option-features li {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 6px;
    padding-left: 20px;
    position: relative;
    line-height: 1.4;
}

.pbd-study-option-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #3b82f6;
    font-weight: bold;
}

/* Study Archive items list (inline display) */
.pbd-study-archive-items {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid #f0f4f8;
}

.pbd-study-archive-items-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a2744;
    margin: 0 0 16px 0;
    letter-spacing: -0.01em;
}

.pbd-study-archive-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pbd-study-archive-item {
    display: flex;
    align-items: center;
    padding: 16px 18px;
    border: 2px solid #e8eef5;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    text-decoration: none;
    color: inherit;
}

.pbd-study-archive-item:hover {
    border-color: #3b4e96;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(38, 57, 110, 0.15);
}

.pbd-study-archive-item.locked {
    cursor: not-allowed;
    opacity: 0.65;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
}

.pbd-study-archive-item.locked:hover {
    border-color: #e8eef5;
    transform: none;
    box-shadow: none;
}

.pbd-study-archive-item-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    margin-right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef2f7 0%, #dce4ed 100%);
    border-radius: 0;
    font-size: 20px;
    transition: all 0.25s ease;
}

.pbd-study-archive-item:hover .pbd-study-archive-item-icon {
    background: linear-gradient(135deg, #3b4e96 0%, #2d3e7a 100%);
    transform: scale(1.1);
}

.pbd-study-archive-item-icon.locked {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #ef4444;
}

.pbd-study-archive-item.locked:hover .pbd-study-archive-item-icon {
    transform: none;
}

.pbd-study-archive-item-content {
    flex: 1;
}

.pbd-study-archive-item-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a2744;
    margin: 0;
    transition: color 0.2s ease;
}

.pbd-study-archive-item:hover .pbd-study-archive-item-title {
    color: #2d3e7a;
}

.pbd-study-archive-item-unlock {
    font-size: 13px;
    color: #ef4444;
    margin: 4px 0 0 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.pbd-study-archive-item-unlock::before {
    content: '🔒';
    font-size: 11px;
}

/* Loading state */
.pbd-study-modal-loading {
    text-align: center;
    padding: 60px 32px;
}

.pbd-study-modal-loading-spinner {
    width: 56px;
    height: 56px;
    border: 5px solid #e8eef5;
    border-top-color: #3b4e96;
    border-right-color: #3b4e96;
    border-radius: 50%;
    animation: spin 0.9s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    margin: 0 auto 20px;
    position: relative;
}

.pbd-study-modal-loading-spinner::after {
    content: '';
    position: absolute;
    inset: 8px;
    border: 5px solid transparent;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite reverse;
}

.pbd-study-modal-loading-text {
    font-size: 16px;
    color: #64748b;
    font-weight: 500;
    letter-spacing: -0.01em;
}

/* Error state */
.pbd-study-modal-error {
    text-align: center;
    padding: 60px 32px;
    color: #ef4444;
}

.pbd-study-modal-error-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: shake 0.5s ease-in-out;
}

.pbd-study-modal-error-text {
    font-size: 16px;
    color: #64748b;
    font-weight: 500;
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(60px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .pbd-study-modal {
        width: 95%;
        max-height: 85vh;
        border-radius: 0;
    }

    .pbd-study-modal-header {
        padding: 24px 24px 16px 24px;
    }

    .pbd-study-modal-title {
        font-size: 22px;
        padding-right: 44px;
    }

    .pbd-study-modal-close {
        top: 20px;
        right: 20px;
        width: 36px;
        height: 36px;
        font-size: 22px;
    }

    .pbd-study-modal-body {
        padding: 24px;
    }

    /* Stack cards vertically on mobile */
    .pbd-study-options {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .pbd-study-option {
        padding: 28px 20px;
        min-height: 240px;
    }

    .pbd-study-option-icon {
        width: 64px;
        height: 64px;
        margin-bottom: 16px;
        font-size: 32px;
    }

    .pbd-study-option-image {
        width: 100px;
        height: 100px;
        margin-bottom: 12px;
    }

    .pbd-study-option-label {
        font-size: 20px;
    }

    .pbd-study-option-description {
        font-size: 14px;
        max-width: 100%;
    }

    .pbd-study-option-meta {
        font-size: 13px;
        margin-top: 10px;
    }

    .pbd-study-archive-items {
        margin-top: 20px;
        padding-top: 20px;
    }

    .pbd-study-archive-items-title {
        font-size: 17px;
    }

    .pbd-study-archive-item {
        padding: 14px 16px;
    }

    .pbd-study-archive-item-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .pbd-study-modal-overlay.active {
        padding: 0;
    }

    .pbd-study-modal {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .pbd-study-modal-header {
        border-radius: 0;
        padding: 20px 20px 16px 20px;
    }

    .pbd-study-modal-title {
        font-size: 19px;
    }

    .pbd-study-modal-body {
        padding: 20px;
    }

    .pbd-study-options {
        gap: 12px;
    }

    .pbd-study-option {
        padding: 24px 18px;
        min-height: 220px;
    }

    .pbd-study-option-icon {
        width: 56px;
        height: 56px;
        margin-bottom: 14px;
        font-size: 28px;
    }

    .pbd-study-option-image {
        width: 90px;
        height: 90px;
    }

    .pbd-study-option-label {
        font-size: 18px;
    }

    .pbd-study-option-description {
        font-size: 13px;
    }

    .pbd-study-option:hover {
        transform: translateY(-2px);
    }
}

/* Custom scrollbar for modal */
.pbd-study-modal::-webkit-scrollbar {
    width: 10px;
}

.pbd-study-modal::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 0;
}

.pbd-study-modal::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #cbd5e1 0%, #94a3b8 100%);
    border-radius: 0;
    border: 2px solid #f8fafc;
}

.pbd-study-modal::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #94a3b8 0%, #64748b 100%);
}
