﻿/* ===== BODY ===== */

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0; /* IMPORTANT: layoutið þarf að fylla skjáinn */
}

/* ÖRYGGISNET: stoppar lárétt overflow sem getur valdið "yfir-lögn" effect */
* {
    box-sizing: border-box;
}

.page-header {
    text-align: center;
    margin-bottom: 30px;
}

    .page-header h1 {
        font-size: 2em;
        color: #2c3e50;
        margin: 0;
    }

    .page-header .tagline {
        font-size: 1em;
        color: #555;
        margin-top: 5px;
    }

h1, h2 {
    color: #2c3e50;
}

.box {
    background: white;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 30px;
    width: 100%;
}

/* ===== FORM ===== */

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.form-group {
    display: flex;
    flex-direction: column;
    flex: 1 1 200px;
    min-width: 150px;
    margin-bottom: 10px;
}

label {
    font-weight: bold;
    margin-bottom: 5px;
}

input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
    width: 100%;
    padding: 8px;
    font-size: 14px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
}

.error {
    color: red;
    margin-top: 10px;
}

.success {
    color: green;
    margin-top: 10px;
    font-weight: bold;
    display: none; /* Byrjar falin */
}

/* ===== BUTTONS ===== */

/* Sameiginleg stærð á öllum helstu tökkum */
button.save-btn,
button.edit-btn,
button.update-btn,
button.delete-btn {
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 530;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

/* Litir */
button.save-btn {
    background-color: #3498db;
    color: white;
}

    button.save-btn:hover {
        background-color: #2980b9;
    }

button.edit-btn {
    background-color: #2ecc71;
    color: white;
}

    button.edit-btn:hover {
        background-color: #27ae60;
    }

button.update-btn {
    background-color: #3498db;
    color: white;
}

    button.update-btn:hover {
        background-color: #2980b9;
    }

button.delete-btn {
    background-color: #e74c3c;
    color: white;
}

    button.delete-btn:hover {
        background-color: #c0392b;
    }

/* aðeins minni edit/delete í töflu (þú varst með þetta) */
button.edit-btn,
button.delete-btn,
button.save-btn {
    padding: 4px 8px !important;
    font-size: 14px !important;
    font-weight: 530;
}

/* ===== AUTOCOMPLETE ===== */

.autocomplete-wrapper {
    position: relative;
}

/* Dropdown */
.autocomplete-items,
#itemSpeciesList {
    display: block;
    position: absolute;
    z-index: 9999;
    width: 100%;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: none;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.12);
    top: 100%;
    left: 0;
    right: 0;
}

.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    user-select: none;
}

    .autocomplete-item:hover {
        background: rgba(0,0,0,0.06);
    }

    /* Virk (valin) lína */
    .autocomplete-item.active,
    .autocomplete-item.autocomplete-active {
        background: rgba(45, 125, 255, 0.18);
        outline: 2px solid rgba(45, 125, 255, 0.35);
        outline-offset: -2px;
    }

/* ===== TABLE ===== */

.table-wrap {
    width: 100%;
    overflow-x: auto;
    max-width: 100%;
    margin-top: 0 !important;
}

table {
    border-collapse: collapse;
    width: 100%;
    min-width: 0;
}

    table th,
    table td {
        border: 1px solid #ccc;
        padding: 6px 8px;
        vertical-align: middle;
        line-height: 1.4;
    }

    table th {
        background-color: #eee;
        font-weight: bold;
        text-align: left;
    }

/* Minna enska nafnið (með svigum) í Tegund dálki */
.english-name {
    font-size: 0.85em;
    opacity: 0.75;
    font-weight: normal;
}

    .english-name em {
        font-style: italic;
    }

/* ===== SPECIES NAME STYLES ===== */

.icelandic-name {
    font-weight: bold;
}

    .icelandic-name .english-name {
        font-weight: normal;
        font-style: italic;
        opacity: 0.8;
    }

.scientific-name {
    font-style: italic;
}

.family-name {
    font-style: italic;
}

/* ===== LEGACY MODAL (gamla kerfið) ===== */

.legacy-modal {
    display: none;
    position: fixed;
    z-index: 50;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.legacy-modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
}

.legacy-modal-close {
    float: right;
    font-size: 20px;
    cursor: pointer;
    color: #888;
}

    .legacy-modal-close:hover {
        color: #000;
    }

.legacy-modal-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

/* ===== RESPONSIVE (fyrir fuglaskráningu + checklist) ===== */

@media (max-width: 720px) {
    .form-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .form-group {
        flex: 0 0 auto !important;
        min-height: 0 !important;
        margin-bottom: 0 !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    textarea {
        min-height: 90px;
    }

    /* ===== CHECKLIST toolbar ===== */
    .checklist-toolbar {
        display: flex;
        align-items: stretch;
        justify-content: space-between;
        gap: 16px;
        flex-wrap: wrap;
        margin: 12px 0 10px 0;
    }

    .checklist-toggle {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        font-weight: 600;
        margin: 0;
        cursor: pointer;
    }

        .checklist-toggle input[type="checkbox"] {
            width: 18px;
            height: 18px;
            cursor: pointer;
        }

    .checklist-hint {
        margin: 6px 0 0 0;
        color: #555;
    }

    /* Takkinn full breidd á síma */
    .checklist-toolbar .save-btn {
        width: 100%;
    }

    #listCount {
        margin-left: 8px;
        padding: 4px 10px;
        border-radius: 999px;
        background: #eef2f7;
        font-size: 14px;
        white-space: nowrap;
    }
}

/* ===== Chart.js ===== */

.chart-wrap {
    position: relative;
    height: 320px;
    width: 100%;
}

    .chart-wrap canvas {
        width: 100% !important;
        height: 100% !important;
        display: block;
    }

/* =========================
   Selected list title above table
   ========================= */

#selectedListInfo {
    text-align: center;
    margin: 4px 0 2px; /* þétt */
    font-size: inherit;
}

/* ef þú ert að nota span.list-type (eldra) */
div#selectedListInfo span.list-type {
    font-size: 0.70em;
    opacity: 0.65;
    font-style: italic;
    font-weight: normal;
}

/* ef þú ert að nota .list-title / .list-meta (nýrra) */
#selectedListInfo .list-title {
    font-size: 26px;
    font-weight: 800;
    color: #1f2937;
}

/* Smærra meta (aftara letrið) */
#selectedListInfo .list-meta {
    display: inline-block;
    margin-left: 10px;
    font-size: 16px;
    font-weight: 400;
    color: #1f2937;
}

/* =========================
   Friends / Users: one-row layout
   ========================= */

#searchResults,
#followingList {
    max-width: 900px;
    width: 100%;
}

    #searchResults .user-row,
    #followingList .user-row {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        justify-content: flex-start !important;
        padding: 12px 0 !important;
        border-bottom: 1px solid rgba(0,0,0,0.06) !important;
    }

    #searchResults .user-main,
    #followingList .user-main {
        min-width: 0 !important;
        display: flex !important;
        align-items: baseline !important;
        gap: 10px !important;
    }

    #searchResults .user-name,
    #followingList .user-name {
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #searchResults .user-meta,
    #followingList .user-meta {
        font-size: 12px;
        white-space: nowrap;
    }

    #searchResults .user-actions,
    #followingList .user-actions {
        margin-left: auto !important;
        flex: 0 0 auto !important;
        white-space: nowrap !important;
    }

/* =========================
   Following list – compact 3-column cards
   ========================= */

#followingList {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    max-width: 1100px;
}

@media (max-width: 1100px) {
    #followingList {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-width: 900px;
    }
}

@media (max-width: 700px) {
    #followingList {
        grid-template-columns: 1fr;
        max-width: 100%;
    }
}

.follow-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    background: #fff;
}

.follow-name {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.1;
}

.follow-meta {
    font-size: 11px;
    line-height: 1.2;
    color: #6b7280;
}

.unfollow-mini {
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid #9ca3af;
    background: transparent;
    color: #374151;
}

    .unfollow-mini:hover {
        background: #f3f4f6;
    }

/* =========================
   Friends feed table (like Recent)
   ========================= */

.feed-table-wrap {
    overflow-x: auto;
}

table.feed-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

    table.feed-table thead th {
        text-align: left;
        font-weight: 700;
        padding: 10px 12px;
        background: rgba(0,0,0,0.04);
        border: 1px solid rgba(0,0,0,0.12);
        white-space: nowrap;
    }

    table.feed-table tbody td {
        padding: 10px 12px;
        border: 1px solid rgba(0,0,0,0.12);
        vertical-align: middle;
    }

    table.feed-table tbody tr:hover {
        background: rgba(0,0,0,0.02);
    }

.feed-species strong {
    font-weight: 700;
}

.feed-species em {
    opacity: 0.8;
}

.feed-table a {
    text-decoration: underline;
}

/* ❗ Fela aðeins add-bird box þegar listi er read-only */
body.readonly #addBirdSection {
    display: none !important;
}

/* ===== FRIENDS LIST links ===== */

.friend-card a,
.friends-grid a,
#friendsWrap a {
    color: inherit;
    text-decoration: none;
}

    .friend-card a:visited,
    .friends-grid a:visited,
    #friendsWrap a:visited {
        color: inherit;
    }

.friend-card .friend-name,
.friends-grid .friend-name,
#friendsWrap .friend-name {
    font-weight: 700;
}

/* ===== FOLLOWING links ===== */

#followingList a.follow-name,
#followingList a.follow-name:visited {
    color: inherit;
    text-decoration: none;
}

    #followingList a.follow-name:hover {
        text-decoration: underline;
        text-underline-offset: 3px;
    }

/* Kort hover */
#followingList .follow-card {
    transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
    cursor: pointer;
}

    #followingList .follow-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 22px rgba(0,0,0,0.08);
        background: rgba(37, 99, 235, 0.04);
        border-color: rgba(37, 99, 235, 0.18);
    }

/* ===== Users page quick stats cards ===== */

.stat-card {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.stat-title {
    font-size: 13px;
    letter-spacing: 0.2px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    margin-top: 6px;
}

/* Smá snyrt í toolbar alignment á þröngum skjá */
.checklist-toolbar select,
.checklist-toolbar input {
    border: 1px solid rgba(0,0,0,0.18);
    border-radius: 10px;
    padding: 8px 10px;
}

/* ==========================================
   Sameiginlegt panel / inner-card (GLOBAL)
    Box fyrir skráningu á fuglum eða listum
   ========================================== */
:root {
    --panel-bg: rgb(229, 231, 235);
    --panel-border: rgba(0,0,0,.08);
    --panel-radius: 14px;
    --panel-padding: 16px;
    --panel-title-color: #334155;
    --panel-title-border: rgba(0,0,0,.08);
}

/* Endurnýtanlegt panel */
.panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--panel-radius);
    padding: var(--panel-padding);
}

/* Endurnýtanlegur titill */
.panel-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--panel-title-color);
    margin-bottom: 16px;
    padding-bottom: 8px;
    line-height: 1.3;
    border-bottom: 1px solid var(--panel-title-border);
}

/* ==========================================
   List-view: Add bird box (uses shared panel)
   ========================================== */

.add-bird-box {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--panel-radius);
    padding: var(--panel-padding);
    margin-bottom: 14px;
}

    .add-bird-box label {
        font-weight: 600;
    }

    .add-bird-box .save-btn {
        margin-top: 10px;
    }

/* Titill inni í add-bird boxi */
.add-bird-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--panel-title-color);
    margin-bottom: 16px;
    padding-bottom: 8px;
    line-height: 1.3;
    border-bottom: 1px solid var(--panel-title-border);
}

@media (max-width: 600px) {
    .add-bird-title {
        font-size: 15px;
        margin-bottom: 18px;
    }
}

/* ✅ Sort + Stats: 2 dálkar
   - vinstri: label + select (lóðrétt)
   - hægri: stats takki
*/
/* ===== List-view: SORT + STATS (clean final) ===== */

#listSortRow.sort-row {
    width: 100%;
    display: grid;
    grid-template-columns: 260px auto; /* vinstri: sort | hægri: takki */
    align-items: end;
    gap: 14px;
    margin: 4px 0 2px; /* 🔥 mjög nálægt töflu */
    text-align: left;
}

/* Raða eftir blokk */
#listSortRow .sort-control {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
}

    #listSortRow .sort-control label {
        margin: 0;
        font-weight: 700;
    }

    #listSortRow .sort-control select {
        width: 100%;
        max-width: 260px;
    }

/* Tölfræði takki */
#listSortRow #statsBtn {
    align-self: end;
    justify-self: start;
    margin: 0;
}

/* Mobile: allt í eina röð */
@media (max-width: 700px) {
    #listSortRow.sort-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    #listSortRow .sort-control select {
        max-width: 100%;
    }
}
/* ==========================================
   List-view: ENDAR
   ========================================*/
    .rare-star {
    margin-right: 6px;
    font-size: 14px;
}

/* ==========================================
   Hunsa takki: Þegar bætt er við fugli sem vantar á Ævilisti - Ísland
   ========================================*/
.save-btn.ghost {
    background-color: #dee2e6;
    color: #212529;
}
/* ======   Hunsa takki: ENDAR   =====*/