/* ========== VARIABLES ========== */
:root {
    --primary: #2563EB;
    --primary-mid: #3B82F6;
    --primary-light: #60A5FA;
    --accent: #F97316;
    --accent-hover: #EA580C;
    --bg-light: #F8FAFC;
    --text-dark: #1E293B;
    --success: #34D399;
    --success-dark: #10B981;
    --danger: #EF4444;
    --warning: #FBBF24;
    --muted: #94A3B8;
}

/* ========== GRADIENT BACKGROUND ========== */
body {
    background-color: #f8f6f4;
    background-image:
        radial-gradient(ellipse 55% 45% at 50% 30%, rgba(186, 210, 240, 0.45) 0%, transparent 70%),
        radial-gradient(ellipse 40% 35% at 45% 25%, rgba(200, 218, 245, 0.35) 0%, transparent 65%),
        radial-gradient(ellipse 50% 45% at 75% 85%, rgba(245, 195, 170, 0.4) 0%, transparent 70%),
        radial-gradient(ellipse 35% 30% at 80% 90%, rgba(248, 180, 155, 0.3) 0%, transparent 65%),
        radial-gradient(ellipse 60% 40% at 55% 95%, rgba(250, 210, 190, 0.25) 0%, transparent 70%),
        radial-gradient(ellipse 30% 25% at 25% 20%, rgba(195, 200, 235, 0.2) 0%, transparent 60%),
        linear-gradient(180deg, #f4f2f0 0%, #f8f6f3 40%, #faf5f0 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* ========== PAGE HEADER ========== */
.page-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    color: var(--text-dark);
    font-size: 28px;
    font-weight: 700;
}

.back-btn {
    padding: 12px 24px;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.back-btn:hover {
    background: var(--primary-mid);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

/* ========== SECTIONS GRID ========== */
.sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* ========== SECTION CARD ========== */
.section-card {
    background: #ffffff;
    border: 1px solid rgba(37, 99, 235, 0.08);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease;
}

.section-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f5f9;
}

.section-title {
    color: var(--text-dark);
    font-size: 20px;
    font-weight: 700;
}

.add-btn {
    padding: 8px 16px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.25);
}

.add-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.35);
}

/* ========== ITEMS LIST ========== */
.items-list {
    max-height: 400px;
    overflow-y: auto;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-light);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.item-row:hover {
    background: #eff6ff;
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.item-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.item-image {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
}

.item-name {
    color: var(--text-dark);
    font-size: 14px;
    font-weight: 500;
}

.item-actions {
    display: flex;
    gap: 8px;
}

.edit-btn,
.delete-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.edit-btn {
    background: #eff6ff;
    border: 1px solid rgba(37, 99, 235, 0.25);
    color: var(--primary);
}

.edit-btn:hover {
    background: #dbeafe;
    border-color: var(--primary-mid);
}

.delete-btn {
    background: #fef2f2;
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--danger);
}

.delete-btn:hover {
    background: #fee2e2;
    border-color: var(--danger);
}

/* ========== MODAL ========== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(6px);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 0;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
    animation: modalSlideIn 0.4s ease;
    overflow: hidden;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #eff6ff, #f8fafc);
}

.modal-title {
    color: var(--text-dark);
    font-size: 22px;
    font-weight: 700;
}

.modal-close {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: var(--muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.3s ease;
    font-weight: 300;
}

.modal-close:hover {
    background: #fee2e2;
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
    transform: scale(1.05);
}

/* ========== FORM STYLING ========== */
.modal form {
    padding: 28px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    background: #ffffff;
    color: var(--text-dark);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-input::placeholder {
    color: var(--muted);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-mid);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.submit-btn {
    width: 100%;
    background: var(--primary);
    border: none;
    color: white;
    padding: 14px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.25);
}

.submit-btn:hover {
    background: var(--primary-mid);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.35);
}

/* ========== CURRENT IMAGE ========== */
.current-image {
    margin-top: 10px;
}

.current-image img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
    font-size: 14px;
}

/* ========== SCROLLBAR ========== */
.items-list::-webkit-scrollbar {
    width: 6px;
}

.items-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.items-list::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 10px;
}

.items-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-mid);
}

/* ── Find photo (Luis, 2026-09-22) ─────────────────────────────────────────
   A secondary button under the file input, and a grid of thumbnails it
   fills. The chosen one takes the page's accent as a ring, the same orange
   the Add buttons use, so "selected" reads in this page's own language. */
.photo-find-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.photo-find-btn {
    padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
    font-family: inherit; cursor: pointer; white-space: nowrap;
    color: #0d2a52; background: #fff; border: 1px solid rgba(13, 42, 82, 0.18);
    transition: border-color .15s ease, background .15s ease;
}
.photo-find-btn:hover { border-color: var(--accent); background: #fff7f0; }
.photo-find-msg { font-size: 12px; color: #64748B; }
.photo-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.photo-grid:empty { display: none; }
.photo-pick {
    width: 86px; height: 86px; padding: 4px; border-radius: 10px; cursor: pointer;
    background: #fff; border: 2px solid rgba(13, 42, 82, 0.12);
    transition: border-color .15s ease, transform .15s ease;
}
.photo-pick img { width: 100%; height: 100%; object-fit: contain; display: block; }
.photo-pick:hover { border-color: rgba(249, 115, 22, 0.55); transform: translateY(-1px); }
.photo-pick.is-sel { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18); }
