/* ══════════════════════════════════════
   Real AI Roleplay Page
   ══════════════════════════════════════ */
.rar-wrap {
    padding: 30px 24px;
    overflow-y: auto;
    position: relative;
    background: #fff;
    border-radius: 12px;
}

.rar-container {
    max-width: 1100px;
    margin: 0 auto;
}

/* Header */
.rar-header {
    text-align: center;
    margin-bottom: 32px;
}

.rar-title {
    font-size: 28px;
    font-weight: 800;
    color: #111827;
    margin: 0 0 8px;
}

.rar-subtitle {
    font-size: 15px;
    color: #6b7280;
    line-height: 1.6;
    max-width: 700px;
    margin: 0 auto;
}

/* Two-column grid */
.rar-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-bottom: 40px;
}

/* Video column */
.rar-video-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.rar-video-card {
    width: 100%;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.rar-video-inner {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    background: #111827;
}

.rar-video-thumb-link {
    display: block;
    text-decoration: none;
}

.rar-video-thumb-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rar-video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.85;
    transition: opacity 0.2s, transform 0.2s;
}

.rar-video-thumb-link:hover .rar-video-play-btn {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

/* Sessions column */
.rar-sessions-col {
    display: flex;
    flex-direction: column;
}

.rar-sessions-title {
    font-size: 17px;
    font-weight: 700;
    color: #111827;
    text-align: center;
    margin-bottom: 16px;
}

.rar-sessions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Session card */
.rar-session-card {
    background: #fff;
    border: 2px solid #d1d5db;
    border-radius: 10px;
    padding: 16px;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.rar-session-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #9ca3af;
}

.rar-session-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.rar-session-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.rar-session-num {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #9ca3af;
    flex-shrink: 0;
}

.rar-session-name {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}

.rar-session-action {
    font-size: 12px;
    color: #9ca3af;
}

.rar-session-start-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: #143e56;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(20, 62, 86, 0.25);
    transition: all 0.2s;
    flex-shrink: 0;
    min-width: 140px;
    justify-content: center;
}

.rar-session-start-btn:hover {
    opacity: 0.9;
    box-shadow: 0 4px 10px rgba(20, 62, 86, 0.35);
}

.rar-session-start-btn svg {
    flex-shrink: 0;
}

/* Session passed state */
.rar-session-passed {
    border-color: #22c55e;
    background: #f0fdf4;
}

.rar-session-num-passed {
    background: #dcfce7;
}

.rar-session-grade-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
    background: #fef2f2;
    color: #ef4444;
}

.rar-session-grade-a {
    background: #dcfce7;
    color: #16a34a;
}

.rar-session-passed-btn {
    background: #16a34a;
}

.rar-session-passed-btn:disabled {
    cursor: not-allowed;
    opacity: 0.8;
}

.rar-session-passed-btn:hover {
    opacity: 0.8;
}

/* Minimum grade bar */
.rar-grade-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    padding: 10px 16px;
    background: #f0fdf4;
    border: 2px solid #bbf7d0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.rar-grade-bar svg {
    flex-shrink: 0;
}

.rar-grade-value {
    color: #16a34a;
    font-size: 18px;
}

/* ══════════════════════════════════════
   Session Modal
   ══════════════════════════════════════ */
.rar-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.rar-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 1100px;
    width: 100%;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Modal header */
.rar-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.rar-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.rar-modal-sub {
    font-size: 13px;
    color: #6b7280;
    margin: 2px 0 0;
}

.rar-modal-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.15s;
    display: flex;
}

.rar-modal-close:hover {
    color: #374151;
}

/* Modal body: two columns */
.rar-modal-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Left: main area */
.rar-modal-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f9fafb;
}

.rar-modal-materials-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}

.rar-modal-materials-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.rar-modal-toggle-docs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.rar-modal-toggle-docs:hover {
    background: #e5e7eb;
}

/* PDF viewer */
.rar-modal-pdf-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rar-pdf-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* Voice controls */
.rar-modal-voice {
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    text-align: center;
}

.rar-voice-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.rar-mic-wrap {
    position: relative;
    width: 64px;
    height: 64px;
}

.rar-mic-ping {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #93c5fd;
    animation: rar-ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
    opacity: 0.3;
}

.rar-mic-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #60a5fa;
    animation: rar-pulse 2s ease-in-out infinite;
    opacity: 0.5;
}

.rar-mic-btn {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

@keyframes rar-ping {
    75%, 100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

@keyframes rar-pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.15); opacity: 0.3; }
}

.rar-end-btn {
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}

.rar-end-btn:hover {
    background: #dc2626;
}

.rar-voice-hint {
    font-size: 13px;
    color: #9ca3af;
    margin-top: 10px;
}

/* Right: Document library sidebar */
.rar-modal-sidebar {
    width: 300px;
    background: #fff;
    border-left: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s, opacity 0.3s;
    overflow: hidden;
}

.rar-modal-sidebar.hidden {
    width: 0;
    opacity: 0;
    border-left: none;
    padding: 0;
}

.rar-sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.rar-sidebar-title {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 4px;
}

.rar-sidebar-sub {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
}

.rar-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Folder */
.rar-folder-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
}

.rar-folder-name {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.rar-folder-count {
    font-size: 12px;
    color: #6b7280;
    margin-left: auto;
}

.rar-folder-chevron {
    transition: transform 0.2s;
}

.rar-folder.collapsed .rar-folder-chevron {
    transform: rotate(-90deg);
}

.rar-folder.collapsed .rar-folder-items {
    display: none;
}

.rar-folder-items {
    margin-top: 8px;
    padding-left: 8px;
}

/* Document item */
.rar-doc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.rar-doc-item:hover {
    background: #f9fafb;
}

.rar-doc-item.active {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.rar-doc-item svg {
    flex-shrink: 0;
}

.rar-doc-name {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    word-break: break-word;
}

.rar-doc-type {
    font-size: 11px;
    color: #9ca3af;
}

/* ══════════════════════════════════════
   Grading Result Modal
   ══════════════════════════════════════ */
.rar-grade-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.rar-grade-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.rar-grade-modal-body {
    padding: 28px 32px;
}

/* Grade circle */
.rar-grade-circle-wrap {
    text-align: center;
    margin-bottom: 24px;
}

.rar-grade-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #dcfce7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.rar-grade-letter {
    font-size: 36px;
    font-weight: 800;
    color: #16a34a;
}

.rar-grade-congrats {
    font-size: 24px;
    font-weight: 800;
    color: #14532d;
    margin: 0 0 6px;
}

.rar-grade-score {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* Performance breakdown */
.rar-perf-section {
    background: #f9fafb;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.rar-perf-title {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 14px;
}

.rar-perf-item {
    margin-bottom: 10px;
}

.rar-perf-item:last-child {
    margin-bottom: 0;
}

.rar-perf-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 4px;
}

.rar-perf-label {
    font-weight: 600;
    color: #374151;
}

.rar-perf-val {
    color: #6b7280;
}

.rar-perf-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.rar-perf-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.rar-perf-red { background: #ef4444; }
.rar-perf-yellow { background: #f59e0b; }
.rar-perf-green { background: #22c55e; }

/* Focus section */
.rar-focus-section {
    border-left: 4px solid #3b82f6;
    padding: 14px 18px;
    margin-bottom: 16px;
}

.rar-focus-title {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 6px;
}

.rar-focus-text {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin: 0;
}

/* What You Did Well */
.rar-well-section {
    background: #f0fdf4;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.rar-well-title {
    font-size: 15px;
    font-weight: 700;
    color: #14532d;
    margin: 0 0 8px;
}

.rar-well-list {
    list-style: disc;
    padding-left: 18px;
    margin: 0;
}

.rar-well-list li {
    font-size: 13px;
    color: #166534;
    margin-bottom: 4px;
}

/* Improve section */
.rar-improve-section {
    background: #f9fafb;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.rar-improve-title {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px;
}

.rar-improve-desc {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 10px;
}

.rar-improve-list {
    list-style: disc;
    padding-left: 18px;
    margin: 0;
}

.rar-improve-list li {
    font-size: 13px;
    color: #374151;
    margin-bottom: 4px;
}

/* Coach's Note */
.rar-coach-section {
    background: #eff6ff;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.rar-coach-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0 0 6px;
}

.rar-coach-text {
    font-size: 13px;
    color: #1e40af;
    margin: 0;
}

/* Continue button */
.rar-grade-continue {
    width: 100%;
    padding: 14px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}

.rar-grade-continue:hover {
    background: #1d4ed8;
}

/* Responsive */
@media (max-width: 768px) {
    .rar-grid {
        grid-template-columns: 1fr;
    }

    .rar-sessions-list {
        max-height: none;
    }

    .rar-title {
        font-size: 22px;
    }

    .rar-wrap {
        padding: 20px 16px;
    }

    .rar-modal-body {
        flex-direction: column;
    }

    .rar-modal-sidebar {
        width: 100%;
        max-height: 200px;
        border-left: none;
        border-top: 1px solid #e5e7eb;
    }

    .rar-modal-sidebar.hidden {
        max-height: 0;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .rar-session-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .rar-session-start-btn {
        width: 100%;
    }
}
