/* =====================================================
   com_waswrong  — site.css
   ===================================================== */

/* ---------- Page wrapper ---------- */
.waswrong-page {
    padding: 1.5rem 1rem 3rem;
    max-width: 900px;
}

/* ---------- Navigation pills ---------- */
.waswrong-nav {
    gap: .4rem;
    margin-bottom: 1.25rem;
}

.waswrong-nav .nav-link {
    border-radius: 2rem;
    padding: .35rem 1rem;
    font-size: .9rem;
    color: #444;
    background: #f3f4f6;
    text-decoration: none;
}

.waswrong-nav .nav-link:hover {
    background: #e2e6ea;
}

.waswrong-nav .nav-link.active {
    background: #0d6efd;
    color: #fff;
}

/* ---------- Page title ---------- */
.ww-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: .75rem;
    color: #1a1a2e;
}

/* ---------- Back link ---------- */
.ww-back-link {
    display: inline-block;
    margin-bottom: 1rem;
    font-size: .9rem;
    color: #0d6efd;
    text-decoration: none;
}

.ww-back-link:hover {
    text-decoration: underline;
}

/* ---------- Subject tabs ---------- */
.ww-subject-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.ww-tab-btn {
    display: inline-block;
    padding: .35rem .9rem;
    border-radius: 2rem;
    background: #f0f1f3;
    color: #333;
    font-size: .85rem;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background .15s;
}

.ww-tab-btn:hover {
    background: #dde2e8;
}

.ww-tab-btn.active {
    background: #0d6efd;
    color: #fff;
    border-color: #0d6efd;
}

/* ---------- Badges ---------- */
.ww-badge {
    display: inline-block;
    padding: .25em .6em;
    border-radius: 1rem;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1;
}

.ww-badge-subject {
    background: #e8f4fd;
    color: #0a6fb5;
}

.ww-badge-done {
    background: #d4edda;
    color: #155724;
}

.ww-badge-pending {
    background: #fff3cd;
    color: #856404;
}

/* ---------- Card grid ---------- */
.ww-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.ww-card {
    display: flex;
    flex-direction: column;
    border-radius: .75rem;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    background: #fff;
    transition: box-shadow .2s, transform .15s;
}

.ww-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,.12);
    transform: translateY(-2px);
}

.ww-card-img-wrap {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f8f8f8;
}

.ww-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ww-card-body {
    padding: .75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.ww-card-meta {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
}

.ww-card-note {
    font-size: .85rem;
    color: #555;
    margin: 0;
    line-height: 1.4;
    /* clamp to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ww-card-date {
    font-size: .78rem;
    color: #999;
    margin: 0 0 0 auto;
}

/* ---------- Detail page ---------- */
.ww-detail-header {
    margin-bottom: 1.25rem;
}

.ww-detail-meta {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: .4rem;
}

.ww-detail-date {
    font-size: .82rem;
    color: #888;
}

.ww-question-img-wrap {
    border-radius: .5rem;
    overflow: hidden;
    background: #f8f8f8;
    margin-bottom: 1.5rem;
    max-width: 640px;
}

.ww-question-img-wrap img {
    width: 100%;
    display: block;
}

.ww-question-img-actions {
    margin-top: -1rem;
    margin-bottom: 1.25rem;
}

/* ---------- Sections ---------- */
.ww-section {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: .75rem;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.explain .ww-section{
    background-color: #c9fffa;
}

.ww-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: .75rem;
    color: #212529;
}

/* OCR + explanation text */
.ww-ocr-text,
.ww-explain-text {
    font-size: 1.23rem;
    line-height: 1.7;
    color: #333;
    white-space: pre-line;
}

.ww-note-text {
    font-size: 1.15rem;
    color: #555;
    line-height: 1.6;
}

/* ---------- Practice questions ---------- */
.ww-practice-card {
    border: 1px solid #dee2e6;
    border-radius: .6rem;
    padding: 1rem;
    margin-bottom: .9rem;
    background: #f9fafb;
}

.ww-practice-q {
    font-size: 1.15rem;
    margin-bottom: .6rem;
    line-height: 1.55;
}

.ww-practice-options {
    list-style: none;
    padding: 0;
    margin: 0 0 .7rem;
}

.ww-option {
    font-size: 1.2rem;
    padding: .3rem 0;
    color: #333;
}

.ww-option-label {
    font-weight: 600;
    color: #0d6efd;
    margin-right: .35rem;
}

.ww-answer-reveal {
    font-size: .88rem;
}

.ww-answer-reveal summary {
    cursor: pointer;
    color: #0d6efd;
    user-select: none;
}

.ww-answer-text {
    margin-top: .4rem;
    color: #155724;
    font-size: .9rem;
}

/* ---------- Analyse section ---------- */
.ww-analyse-section {
    text-align: center;
    padding: 2rem 1.25rem;
}

.ww-pending-msg {
    font-size: .95rem;
    color: #555;
    margin-bottom: 1.25rem;
}

.ww-analyse-btn {
    font-size: 1.05rem;
    padding: .6rem 2rem;
}

/* ---------- Loading overlay ---------- */
.ww-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ww-loading-box {
    background: #fff;
    border-radius: 1rem;
    padding: 2.5rem 3rem;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
}

.ww-loading-box p {
    margin: .9rem 0 0;
    font-size: 1rem;
    color: #333;
}

/* Spinner */
.ww-spinner {
    width: 48px;
    height: 48px;
    border: 5px solid #e0e0e0;
    border-top-color: #0d6efd;
    border-radius: 50%;
    animation: ww-spin .8s linear infinite;
    margin: 0 auto;
}

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

/* ---------- Upload form ---------- */
.ww-upload-wrap {
    max-width: 560px;
}

.ww-img-preview {
    margin-top: .5rem;
    border-radius: .5rem;
    overflow: hidden;
    border: 1px solid #ddd;
    max-width: 320px;
}

.ww-img-preview img {
    width: 100%;
    display: block;
}

/* ---------- Crop modal ---------- */
.ww-crop-modal {
    position: fixed;
    inset: 0;
    z-index: 10020;
    background: rgba(0, 0, 0, .7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ww-crop-panel {
    width: min(100%, 480px);
    background: #fff;
    border-radius: .85rem;
    padding: 1rem;
}

@media screen and (min-width: 992px) {
    .ww-crop-modal {
        padding: 1.5rem;
    }

    .ww-crop-panel {
        width: min(100%, 1040px);
        padding: 1.25rem 1.5rem;
    }

    .ww-crop-panel h2 {
        font-size: 1.2rem;
    }

    .ww-crop-hint {
        font-size: .95rem;
        margin-bottom: 1rem;
    }

    .ww-crop-stage {
        border-radius: .75rem;
    }

    .ww-crop-actions {
        margin-top: 1rem;
    }
}

.ww-crop-panel h2 {
    margin: 0 0 .35rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.ww-crop-hint {
    margin: 0 0 .75rem;
    color: #666;
    font-size: .88rem;
}

.ww-crop-stage {
    position: relative;
    border-radius: .5rem;
    overflow: hidden;
    border: 1px solid #ddd;
    background: #111;
}

#ww-crop-canvas {
    display: block;
    width: 100%;
    height: auto;
    touch-action: none;
}

.ww-crop-rect {
    position: absolute;
    border: 2px dashed #0d6efd;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35);
    pointer-events: none;
}

.ww-crop-actions {
    display: flex;
    gap: .5rem;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: .8rem;
}

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

    .ww-loading-box {
        padding: 2rem 1.5rem;
    }

    .ww-crop-panel {
        width: 100%;
        padding: .85rem;
    }
}

/* ---------- Delete button ---------- */
.ww-card-wrap {
    position: relative;
}

.ww-card-delete-form {
    position: absolute;
    top: .5rem;
    right: .5rem;
    z-index: 2;
    margin: 0;
}

.ww-card-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(220, 53, 69, .85);
    color: #fff;
    font-size: .9rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s;
}

.ww-card-wrap:hover .ww-card-delete-btn {
    opacity: 1;
}

.ww-card-edit-btn {
    position: absolute;
    top: .5rem;
    right: 3rem;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(13, 110, 253, .9);
    color: #fff;
    font-size: .9rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s;
}

.ww-card-wrap:hover .ww-card-edit-btn {
    opacity: 1;
}

.ww-card-edit-data {
    display: none;
}

.ww-edit-modal {
    position: fixed;
    inset: 0;
    z-index: 10030;
    background: rgba(0, 0, 0, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ww-edit-modal-panel {
    width: min(100%, 440px);
    background: #fff;
    border-radius: .85rem;
    padding: 1rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .2);
}

.ww-edit-modal-panel h2 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.ww-edit-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
}

.ww-detail-delete-form {
    margin-top: .75rem;
}

