/* Activity 1.3 — Annotation / Labelling Tool styles */

/* ── Panel layout ─────────────────────────────────────────── */
#tab-annotate {
    display: none;
    flex-direction: column;
    gap: 0;
}
#tab-annotate.active {
    display: flex;
}

/* ── Status banner (shown when no polygon is drawn) ──────── */
.annotation-status-banner {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: start;
    column-gap: 10px;
    background: rgba(14, 165, 233, 0.07);
    border: 1px solid rgba(14, 165, 233, 0.2);
    border-radius: 10px;
    padding: 10px 12px;
    margin: 12px 0 8px;
    font-size: 12px;
    line-height: 1.35;
    color: #4a7aa7;
}
.annotation-status-banner svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
}

/* ── No prediction layer warning ────────────────────────── */
.annotation-no-layer-msg {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: start;
    column-gap: 10px;
    background: rgba(245, 158, 11, 0.07);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 10px;
    padding: 10px 12px;
    margin: 8px 0;
    font-size: 12px;
    line-height: 1.35;
    color: #92610a;
}
.annotation-no-layer-msg svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
}

.annotation-message-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.annotation-message-text strong {
    font-weight: 700;
}

/* ── Annotation form ─────────────────────────────────────── */
.annotation-form {
    margin: 8px 0 16px;
}
.annotation-form .form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.annotation-form .form-label-hint {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: #888;
    font-size: 11px;
}
.annotation-form select,
.annotation-form textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d0d8e4;
    border-radius: 8px;
    padding: 9px 11px;
    font-size: 14px;
    font-family: inherit;
    color: #222;
    background: #fff;
    margin-bottom: 10px;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
}
.annotation-form select:focus,
.annotation-form textarea:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.15);
}
.annotation-form textarea {
    resize: vertical;
    min-height: 70px;
}
.annotation-form .btn-save-annotation {
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, #0ea5e9, #10b981);
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
    min-height: 44px;
}
.annotation-form .btn-save-annotation:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.annotation-form .btn-save-annotation:not(:disabled):hover {
    opacity: 0.88;
}

/* ── Divider ─────────────────────────────────────────────── */
.annotation-divider {
    border: none;
    border-top: 1px solid #e8edf2;
    margin: 4px 0 12px;
}

/* ── Saved annotations list ──────────────────────────────── */
.annotation-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 10px;
}
.annotation-list-header h4 {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.annotation-list-header .annotation-count {
    font-size: 12px;
    color: #888;
}

.annotation-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0 0 20px;
    overflow-y: auto;
}

.annotation-item {
    border: 1px solid #e4e9f0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: border-color 0.15s;
    overflow: hidden;
}
.annotation-item.on-map {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.04);
}

/* Collapsed summary row — always visible, clickable */
.annotation-item-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    cursor: pointer;
    user-select: none;
}
.annotation-item-summary:hover {
    background: rgba(0,0,0,0.02);
}

.annotation-class-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}
.annotation-class-label {
    font-size: 12px;
    font-weight: 600;
    color: #222;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.annotation-date {
    font-size: 11px;
    color: #bbb;
    white-space: nowrap;
}
.annotation-chevron {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M5 7l3 3 3-3' stroke='%23bbb' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    transition: transform 0.18s;
}
.annotation-item.expanded .annotation-chevron {
    transform: rotate(180deg);
}

/* Expandable details section */
.annotation-item-details {
    display: none;
    padding: 0 11px 10px 11px;
    border-top: 1px solid #f0f4f8;
}
.annotation-item.expanded .annotation-item-details {
    display: block;
}

.annotation-class-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #666;
    margin-bottom: 6px;
    padding-top: 8px;
}
.annotation-class-current { color: #888; }
.annotation-class-arrow { color: #aaa; }
.annotation-class-target { color: #10b981; font-weight: 600; }

.annotation-notes {
    font-size: 12px;
    color: #666;
    margin-bottom: 9px;
}

.annotation-item-actions {
    display: flex;
    gap: 6px;
}
.annotation-item-actions button {
    flex: 1;
    padding: 6px 8px;
    border-radius: 7px;
    border: 1px solid #d0d8e4;
    background: #f8fafc;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    min-height: 32px;
    white-space: nowrap;
}
.annotation-item-actions .btn-show-map {
    color: #0ea5e9;
    border-color: #b3ddf7;
}
.annotation-item-actions .btn-show-map:hover,
.annotation-item-actions .btn-show-map.active {
    background: rgba(14, 165, 233, 0.08);
    border-color: #0ea5e9;
}
.annotation-item-actions .btn-trash-annotation {
    color: #e53e3e;
    border-color: #fca5a5;
}
.annotation-item-actions .btn-trash-annotation:hover {
    background: rgba(239, 68, 68, 0.07);
    border-color: #e53e3e;
}

.annotation-empty-state {
    text-align: center;
    padding: 28px 16px;
    color: #aaa;
    font-size: 13px;
}

.annotation-loading {
    text-align: center;
    padding: 20px;
    color: #aaa;
    font-size: 13px;
}

/* ── Mobile overrides ────────────────────────────────────── */
@media (max-width: 600px) {
    .annotation-status-banner,
    .annotation-no-layer-msg {
        grid-template-columns: 16px minmax(0, 1fr);
        column-gap: 8px;
        padding: 9px 10px;
        font-size: 11.5px;
    }

    .annotation-status-banner svg,
    .annotation-no-layer-msg svg {
        width: 16px;
        height: 16px;
    }

    .annotation-form select,
    .annotation-form textarea,
    .annotation-form .btn-save-annotation {
        font-size: 16px; /* prevents iOS zoom on focus */
    }
    .annotation-item-actions button {
        min-height: 40px;
        font-size: 13px;
    }
}
