/* ================================================
   CCE Assessment Worksheet — Front CSS v4.0
   ================================================ */

/* ── CSS Custom Properties ── */
:root {
    --cce-primary:       #4f46e5;
    --cce-primary-light: #818cf8;
    --cce-primary-dark:  #3730a3;
    --cce-success:       #16a34a;
    --cce-error:         #dc2626;
    --cce-warning:       #d97706;
    --cce-bg:            #f5f6ff;
    --cce-surface:       #ffffff;
    --cce-surface2:      #f8f9ff;
    --cce-border:        #e0e3f8;
    --cce-text:          #1e1b4b;
    --cce-text-muted:    #6b7280;
    --cce-shadow:        0 4px 20px rgba(79,70,229,.12);
    --cce-radius:        12px;
    --cce-radius-sm:     8px;
    --cce-font:          'Mangal', 'Noto Sans Devanagari', 'Segoe UI', sans-serif;
}

html.cce-dark {
    --cce-bg:         #0f0e2a;
    --cce-surface:    #1a1840;
    --cce-surface2:   #13122e;
    --cce-border:     #2e2b5a;
    --cce-text:       #e0e0f8;
    --cce-text-muted: #9492c0;
    --cce-shadow:     0 4px 24px rgba(0,0,0,.4);
}

/* ── Utility ── */
.cce-notice { padding: 10px 16px; border-radius: var(--cce-radius-sm); font-size: 15px; }
.cce-notice-error { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--cce-error); }

/* ── Hero Section ── */
.cce-hero {
    background: linear-gradient(135deg, var(--cce-primary) 0%, var(--cce-primary-dark) 100%);
    color: #fff;
    border-radius: 20px;
    padding: 44px 32px 30px;
    margin: 18px 0 28px;
    overflow: hidden;
    position: relative;
}
.cce-hero::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 220px; height: 220px;
    background: rgba(255,255,255,.07);
    border-radius: 50%;
    pointer-events: none;
}
.cce-hero-inner { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.cce-hero-text  { flex: 2; min-width: 260px; }
.cce-hero-img   { flex: 1; min-width: 220px; text-align: center; }
.cce-hero-img img { max-width: 100%; border-radius: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.cce-badge {
    display: inline-block;
    background: rgba(255,255,255,.2);
    backdrop-filter: blur(4px);
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .5px;
    margin-bottom: 10px;
}
.cce-hero h1 { font-size: 34px; margin: 6px 0 10px; line-height: 1.25; font-weight: 800; }
.cce-hero p  { font-size: 16px; opacity: .9; margin: 0; line-height: 1.6; }
.cce-trust {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,.25);
    display: flex; flex-wrap: wrap; gap: 10px;
    font-size: 13px; align-items: center;
}
.cce-trust strong { margin-right: 4px; opacity: .9; }
.cce-trust span {
    background: rgba(255,255,255,.18);
    padding: 4px 12px;
    border-radius: 999px;
    font-weight: 600;
}

/* ── Worksheet Container ── */
.cce-worksheet {
    position: relative;
    background: var(--cce-surface);
    border: 1.5px solid var(--cce-border);
    border-radius: 20px;
    padding: 28px 28px 24px;
    margin: 20px 0;
    color: var(--cce-text);
    font-family: var(--cce-font);
    box-shadow: var(--cce-shadow);
    transition: box-shadow .3s;
}

/* ── Dark Toggle ── */
.cce-dark-toggle {
    position: absolute;
    top: 16px; right: 16px;
    background: var(--cce-surface2);
    border: 1.5px solid var(--cce-border);
    border-radius: 50%;
    width: 38px; height: 38px;
    font-size: 18px;
    cursor: pointer;
    color: var(--cce-text);
    display: flex; align-items: center; justify-content: center;
    transition: background .2s, transform .2s;
    z-index: 10;
}
.cce-dark-toggle:hover { background: var(--cce-border); transform: scale(1.1); }

/* ── Header ── */
.cce-ws-header { margin-bottom: 20px; }
.cce-ws-title-row h2 {
    margin: 0 0 18px;
    color: var(--cce-primary);
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: .3px;
    padding-bottom: 12px;
    border-bottom: 2px dashed var(--cce-primary);
}

/* ── Meta Grid ── */
.cce-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px 18px;
    margin: 14px 0;
    padding: 14px 16px;
    background: var(--cce-surface2);
    border-radius: var(--cce-radius);
    border: 1px solid var(--cce-border);
}
.cce-meta-item { display: flex; flex-direction: column; gap: 3px; }
.cce-meta-item label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: var(--cce-text-muted);
}
.cce-meta-item span {
    font-size: 14px;
    font-weight: 600;
    color: var(--cce-text);
}
.cce-meta-name { grid-column: 1 / -1; }
.cce-student-name {
    border: none;
    border-bottom: 2px solid var(--cce-primary);
    background: transparent;
    color: var(--cce-text);
    padding: 4px 6px 4px 0;
    font-size: 16px;
    font-weight: 700;
    font-family: var(--cce-font);
    outline: none;
    width: 100%;
    max-width: 360px;
    transition: border-color .2s;
}
.cce-student-name:focus { border-bottom-color: var(--cce-primary-dark); }
.cce-student-name::placeholder { font-weight: 400; color: var(--cce-text-muted); }

/* ── Intro / Instructions ── */
.cce-intro-box {
    background: linear-gradient(135deg, #fef9c3, #fef3c7);
    color: #78350f;
    padding: 12px 16px;
    border-radius: var(--cce-radius-sm);
    margin: 14px 0;
    font-size: 14.5px;
    border-left: 4px solid #f59e0b;
    line-height: 1.6;
}
html.cce-dark .cce-intro-box { background: #451a03; color: #fde68a; border-left-color: #d97706; }

/* ── Timer ── */
.cce-timer-wrap { margin-top: 12px; }
.cce-timer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--cce-primary);
    color: #fff;
    padding: 8px 20px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 18px;
    box-shadow: 0 3px 10px rgba(79,70,229,.3);
    transition: background .3s;
}
.cce-timer-icon { font-size: 20px; }
.cce-timer-warn {
    background: var(--cce-error) !important;
    animation: cce-pulse 1s infinite;
}
@keyframes cce-pulse { 50% { opacity: .65; } }

/* ── Premium Lock ── */
.cce-premium-lock {
    text-align: center;
    padding: 32px 24px;
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 2px dashed #f59e0b;
    border-radius: var(--cce-radius);
    margin: 16px 0;
}
html.cce-dark .cce-premium-lock { background: #1c1400; border-color: #d97706; }
.cce-lock-icon { font-size: 48px; margin-bottom: 8px; }
.cce-premium-lock h3 { font-size: 22px; color: #92400e; margin: 8px 0; }
html.cce-dark .cce-premium-lock h3 { color: #fde68a; }
.cce-premium-lock p  { color: var(--cce-text-muted); margin: 6px 0 18px; }

/* ── Sections ── */
.cce-section { margin: 24px 0; }
.cce-section-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 17px;
    font-weight: 800;
    color: var(--cce-primary);
    background: linear-gradient(135deg, rgba(79,70,229,.08), rgba(79,70,229,.03));
    padding: 10px 16px;
    border-radius: var(--cce-radius-sm);
    border-left: 4px solid var(--cce-primary);
    margin: 16px 0 12px;
}
.cce-section-icon { font-size: 20px; }

/* ── Questions List ── */
.cce-questions {
    list-style: none;
    padding: 0; margin: 0;
    counter-reset: cce-q-counter;
}
.cce-q {
    counter-increment: cce-q-counter;
    position: relative;
    margin: 14px 0;
    padding: 16px 18px 16px 56px;
    background: var(--cce-surface2);
    border-radius: var(--cce-radius);
    border: 1.5px solid var(--cce-border);
    transition: border-color .25s, background .25s, box-shadow .25s;
}
.cce-q::before {
    content: counter(cce-q-counter);
    position: absolute;
    left: 14px; top: 15px;
    width: 28px; height: 28px;
    background: var(--cce-primary);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}
.cce-q-correct {
    border-color: var(--cce-success);
    background: rgba(22,163,74,.07);
}
.cce-q-correct::before { background: var(--cce-success); }
.cce-q-wrong   {
    border-color: var(--cce-error);
    background: rgba(220,38,38,.07);
}
.cce-q-wrong::before { background: var(--cce-error); }

.cce-q-text {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 12px;
    color: var(--cce-text);
}
.cce-q-img-wrap { margin: 8px 0 12px; }
.cce-q-img {
    max-width: 320px;
    border-radius: var(--cce-radius-sm);
    border: 1.5px solid var(--cce-border);
    padding: 4px;
    background: #fff;
    display: block;
}

/* ── MCQ ── */
.cce-mcq {
    list-style: none;
    padding: 0; margin: 4px 0 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.cce-tf { grid-template-columns: 1fr 1fr; }
.cce-mcq-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 14px;
    border-radius: var(--cce-radius-sm);
    border: 1.5px solid var(--cce-border);
    background: var(--cce-surface);
    transition: all .2s;
    user-select: none;
}
.cce-mcq-label:hover { border-color: var(--cce-primary-light); background: rgba(79,70,229,.06); }
.cce-mcq-label.cce-selected {
    border-color: var(--cce-primary);
    background: rgba(79,70,229,.1);
}
.cce-mcq-label.cce-ans-correct {
    border-color: var(--cce-success);
    background: rgba(22,163,74,.12);
}
.cce-mcq-label.cce-ans-wrong {
    border-color: var(--cce-error);
    background: rgba(220,38,38,.1);
}
.cce-opt-letter {
    display: flex; align-items: center; justify-content: center;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--cce-border);
    color: var(--cce-text);
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
    transition: background .2s, color .2s;
}
.cce-mcq-label.cce-selected .cce-opt-letter { background: var(--cce-primary); color: #fff; }
.cce-mcq-label.cce-ans-correct .cce-opt-letter { background: var(--cce-success); color: #fff; }
.cce-mcq-label.cce-ans-wrong .cce-opt-letter { background: var(--cce-error); color: #fff; }
.cce-opt-text { font-size: 14.5px; font-weight: 600; line-height: 1.4; }

/* ── Fill / Short / Image ── */
.cce-fill-wrap { margin-top: 6px; }
.cce-input {
    width: 100%;
    max-width: 480px;
    padding: 10px 14px;
    border: 1.5px solid var(--cce-border);
    border-radius: var(--cce-radius-sm);
    background: var(--cce-surface);
    color: var(--cce-text);
    font-size: 15px;
    font-family: var(--cce-font);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}
.cce-input:focus { border-color: var(--cce-primary); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
.cce-textarea { max-width: 100%; resize: vertical; }
.cce-image-activity { margin-top: 6px; }
.cce-image-hint { font-size: 13px; color: var(--cce-text-muted); margin: 0 0 8px; }

/* ── Match Table ── */
.cce-match-wrap { margin-top: 8px; overflow-x: auto; }
.cce-match {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--cce-radius-sm);
    overflow: hidden;
}
.cce-match th {
    background: var(--cce-primary);
    color: #fff;
    padding: 10px 14px;
    text-align: left;
    font-size: 14px;
    font-weight: 700;
}
.cce-match td {
    border: 1px solid var(--cce-border);
    padding: 10px 14px;
    font-size: 14.5px;
    vertical-align: middle;
}
.cce-match tr:nth-child(even) td { background: var(--cce-surface2); }
.cce-match-sel {
    padding: 8px 10px;
    border: 1.5px solid var(--cce-border);
    border-radius: var(--cce-radius-sm);
    background: var(--cce-surface);
    color: var(--cce-text);
    font-size: 14px;
    font-family: var(--cce-font);
    cursor: pointer;
    width: 100%;
    outline: none;
    transition: border-color .2s;
}
.cce-match-sel:focus { border-color: var(--cce-primary); }

/* ── Feedback & Explain ── */
.cce-feedback {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: var(--cce-radius-sm);
    font-size: 14px;
    border: 1.5px dashed var(--cce-border);
    line-height: 1.6;
}
.cce-q-correct .cce-feedback {
    border-color: var(--cce-success);
    background: rgba(22,163,74,.08);
    color: #15803d;
}
.cce-q-wrong .cce-feedback {
    border-color: var(--cce-error);
    background: rgba(220,38,38,.08);
    color: #b91c1c;
}
.cce-explain {
    margin-top: 8px;
    padding: 10px 14px;
    background: rgba(245,158,11,.1);
    color: #92400e;
    border-radius: var(--cce-radius-sm);
    font-size: 14px;
    border-left: 3px solid #f59e0b;
    line-height: 1.6;
}
html.cce-dark .cce-explain { background: #1c1000; color: #fde68a; }

/* ── Actions ── */
.cce-actions {
    margin-top: 24px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* ── Buttons ── */
.cce-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 11px 22px;
    border: none;
    border-radius: var(--cce-radius-sm);
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    font-family: var(--cce-font);
    text-decoration: none;
    transition: transform .15s, box-shadow .15s, opacity .2s;
    white-space: nowrap;
}
.cce-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.15); }
.cce-btn:active:not(:disabled) { transform: translateY(0); }
.cce-btn:disabled { opacity: .65; cursor: not-allowed; }
.cce-btn-icon { font-size: 16px; }

.cce-btn-primary  { background: var(--cce-primary); color: #fff; }
.cce-btn-primary:hover:not(:disabled) { background: var(--cce-primary-dark); }

.cce-btn-secondary {
    background: transparent;
    color: var(--cce-primary);
    border: 2px solid var(--cce-primary);
}
.cce-btn-secondary:hover:not(:disabled) { background: rgba(79,70,229,.08); }

.cce-btn-wa   { background: #25d366; color: #fff; }
.cce-btn-fb   { background: #1877f2; color: #fff; }
.cce-btn-cert { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.cce-btn-copy { background: #475569; color: #fff; }
.cce-btn-rzp  { background: #2563eb; color: #fff; }

/* ── Result Card ── */
.cce-result { margin-top: 28px; }
.cce-result-card {
    border: 3px solid var(--cce-primary);
    border-radius: 18px;
    overflow: hidden;
    background: var(--cce-surface);
    box-shadow: 0 10px 40px rgba(79,70,229,.18);
}
.cce-result-header {
    padding: 22px 24px;
    text-align: center;
    color: #fff;
}
.cce-result-header h2 { margin: 0; font-size: 26px; font-weight: 800; }
.cce-result-header p  { margin: 6px 0 0; opacity: .9; font-size: 15px; }
.cce-result-body { padding: 28px 24px; text-align: center; }
.cce-r-name { font-size: 26px; font-weight: 800; margin: 0 0 18px; color: var(--cce-text); }
.cce-r-stats {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin: 16px 0;
}
.cce-r-stat {
    padding: 14px 20px;
    background: var(--cce-surface2);
    border: 1.5px solid var(--cce-border);
    border-radius: var(--cce-radius);
    min-width: 110px;
}
.cce-r-stat-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--cce-text-muted);
    margin-bottom: 6px;
}
.cce-r-stat-val {
    display: block;
    font-size: 28px;
    font-weight: 800;
}
.cce-r-msg {
    font-size: 22px;
    font-weight: 800;
    margin: 16px 0;
}
.cce-r-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 16px;
}

/* ── Google Gate ── */
#cce-gate {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.65);
    display: flex; align-items: center; justify-content: center;
    z-index: 99999;
    backdrop-filter: blur(4px);
}
.cce-gate-box {
    background: var(--cce-surface);
    color: var(--cce-text);
    padding: 36px 30px;
    border-radius: 20px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.cce-gate-box h3 { font-size: 22px; margin: 0 0 10px; }
.cce-gate-box p  { color: var(--cce-text-muted); margin: 0 0 18px; line-height: 1.6; }
#cce-gsi { display: flex; justify-content: center; margin: 14px 0; }

/* ── Grid / Cards ── */
.cce-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin: 20px 0;
}
.cce-card {
    background: var(--cce-surface);
    border: 1.5px solid var(--cce-border);
    border-radius: var(--cce-radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform .2s, box-shadow .2s, border-color .2s;
    display: block;
}
.cce-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(79,70,229,.15);
    border-color: var(--cce-primary-light);
}
.cce-card img     { width: 100%; height: 165px; object-fit: cover; }
.cce-card-placeholder {
    width: 100%; height: 165px;
    background: linear-gradient(135deg, rgba(79,70,229,.1), rgba(79,70,229,.05));
    display: flex; align-items: center; justify-content: center;
    font-size: 48px;
}
.cce-card-body  { padding: 14px 16px 16px; }
.cce-card-premium { border-color: #f59e0b; }
.cce-premium-badge {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
}
.cce-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--cce-primary);
    line-height: 1.4;
}
.cce-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cce-card-tags span {
    background: rgba(79,70,229,.1);
    color: var(--cce-primary);
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

/* ── Footer ── */
.cce-footer {
    text-align: center;
    padding: 22px;
    color: var(--cce-text-muted);
    border-top: 1px solid var(--cce-border);
    margin-top: 32px;
    font-size: 14px;
}

/* ── Progress Bar (visual flair on result) ── */
.cce-progress-bar {
    height: 8px;
    background: var(--cce-border);
    border-radius: 999px;
    overflow: hidden;
    margin: 10px 0 4px;
}
.cce-progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 1s ease-out;
}

/* ── Responsive ── */
@media (max-width: 700px) {
    .cce-meta-grid { grid-template-columns: 1fr 1fr; }
    .cce-mcq { grid-template-columns: 1fr; }
    .cce-hero h1 { font-size: 24px; }
    .cce-worksheet { padding: 18px 16px; }
    .cce-q { padding-left: 46px; }
    .cce-r-stats { gap: 10px; }
}

/* ── Print ── */
@media print {
    body * { visibility: hidden; }
    .cce-worksheet, .cce-worksheet *,
    .cce-result, .cce-result * { visibility: visible; }
    .cce-worksheet { position: absolute; left: 0; top: 0; width: 100%; border: none; box-shadow: none; border-radius: 0; }
    .no-print, .cce-actions, .cce-r-actions, .cce-dark-toggle, .cce-timer-wrap { display: none !important; }
}
