/* Tory's Zoo — App Stylesheet */
/* Extracted from mockup.html and adapted for production */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f5f0eb;
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

/* App header */
.appheader {
    background: #2d5a27;
    color: white;
    padding: 12px 16px 16px;
    flex-shrink: 0;
}

.appheader h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.appheader .subtitle {
    font-size: 12px;
    opacity: 0.75;
    margin-top: 2px;
}

/* Species filter tabs */
.species-tabs {
    background: #2d5a27;
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0 12px 10px;
    gap: 6px;
    flex-shrink: 0;
}

.species-tabs::-webkit-scrollbar { display: none; }

.tab {
    background: rgba(255,255,255,0.15);
    color: white;
    border: none;
    border-radius: 16px;
    padding: 5px 12px;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s;
}

.tab.active {
    background: white;
    color: #2d5a27;
    font-weight: 600;
}

.tab .count {
    background: rgba(255,255,255,0.3);
    color: white;
    border-radius: 8px;
    padding: 0 5px;
    font-size: 10px;
    margin-left: 4px;
}

.tab.active .count {
    background: #2d5a27;
    color: white;
}

/* Search bar */
.searchbar {
    background: white;
    padding: 10px 14px;
    flex-shrink: 0;
    border-bottom: 1px solid #e0d8d0;
}

.searchbar input {
    width: 100%;
    background: #f0ebe4;
    border: none;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 14px;
    color: #333;
    outline: none;
}

/* Scrollable content area */
.content {
    flex: 1;
    overflow-y: auto;
    background: #f5f0eb;
}

/* Animal grid */
.animal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 14px;
}

.animal-card {
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
}

.animal-card:active { transform: scale(0.97); }

.animal-photo {
    width: 100%;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    position: relative;
}

/* Status overlays */
.badge {
    position: absolute;
    bottom: 6px;
    left: 6px;
    right: 6px;
    border-radius: 6px;
    padding: 3px 7px;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
}

.badge-pending {
    background: rgba(255, 165, 0, 0.92);
    color: white;
}

.badge-missing {
    background: rgba(220, 50, 50, 0.92);
    color: white;
}

/* Inactive dimming */
.animal-card.inactive .animal-photo {
    opacity: 0.4;
}

.animal-card.inactive .badge-inactive {
    background: rgba(100,100,100,0.85);
    color: white;
    position: absolute;
    bottom: 6px;
    left: 6px;
    right: 6px;
    border-radius: 6px;
    padding: 3px 7px;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
}

.animal-info {
    padding: 8px 10px 10px;
}

.animal-name {
    font-size: 14px;
    font-weight: 600;
    color: #222;
}

.animal-meta {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

/* Bottom nav */
.bottomnav {
    background: white;
    border-top: 1px solid #e0d8d0;
    display: flex;
    flex-shrink: 0;
}

.navbtn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0 14px;
    cursor: pointer;
    border: none;
    background: none;
    color: #aaa;
    font-size: 10px;
    gap: 3px;
    transition: color 0.2s;
}

.navbtn.active { color: #2d5a27; }

.navbtn .icon { font-size: 22px; }

/* ============================
   SCREENS
============================ */
.screen { display: none; flex-direction: column; height: 100%; }
.screen.active { display: flex; }

/* ============================
   SCREEN: ANIMAL DETAIL
============================ */
.back-btn {
    background: none;
    border: none;
    color: white;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.85;
}

.detail-photo {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
    background: #e8f5e3;
    flex-shrink: 0;
}

.detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.field-group {
    background: white;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.field-group h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #2d5a27;
    font-weight: 700;
    margin-bottom: 10px;
}

.field-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 5px 0;
    border-bottom: 1px solid #f0ebe4;
    font-size: 14px;
}

.field-row:last-child { border-bottom: none; }

.field-label { color: #888; font-size: 13px; }
.field-value { color: #222; font-weight: 500; text-align: right; max-width: 60%; }

.status-chip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.chip-active { background: #e8f5e3; color: #2d5a27; }
.chip-pending { background: #fff3cd; color: #856404; }
.chip-missing { background: #fde8e8; color: #c0392b; }
.chip-inactive { background: #f0f0f0; color: #666; }

.notes-text {
    font-size: 14px;
    color: #444;
    line-height: 1.5;
}

.edit-btn {
    width: 100%;
    background: #2d5a27;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
}

/* ============================
   SCREEN: ADD / EDIT ANIMAL
============================ */
.add-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.photo-picker {
    background: #e8f5e3;
    border: 2px dashed #7ab870;
    border-radius: 14px;
    height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    cursor: pointer;
    gap: 8px;
}

.photo-picker .cam-icon { font-size: 36px; }
.photo-picker span { font-size: 14px; color: #666; }

.form-group {
    background: white;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.form-group label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #2d5a27;
    font-weight: 700;
    padding: 12px 14px 4px;
}

.form-group select,
.form-group input,
.form-group textarea {
    width: 100%;
    border: none;
    padding: 8px 14px 12px;
    font-size: 15px;
    color: #222;
    background: white;
    outline: none;
    appearance: none;
}

.form-group textarea {
    resize: none;
    height: 80px;
}

.breeding-section {
    background: #f8fdf6;
    border: 1px solid #c8e6c2;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
}

.breeding-section h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #2d5a27;
    font-weight: 700;
    margin-bottom: 10px;
}

.optional-tag {
    font-size: 10px;
    color: #aaa;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.save-btn {
    width: 100%;
    background: #2d5a27;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 4px;
}

/* ============================
   SCREEN: PEOPLE
============================ */
.people-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.person-card {
    background: white;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
}

.person-avatar {
    width: 44px;
    height: 44px;
    border-radius: 22px;
    background: #3a4a7a;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

.person-info { flex: 1; }
.person-name { font-size: 15px; font-weight: 600; color: #222; }
.person-meta { font-size: 12px; color: #888; margin-top: 2px; }
.person-interest { font-size: 11px; color: #3a4a7a; margin-top: 3px; font-weight: 500; }

.person-status {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 8px;
    font-weight: 600;
}

.ps-active { background: #e8f5e3; color: #2d5a27; }
.ps-hibernated { background: #f0f0f0; color: #888; }

/* FAB */
.fab {
    position: fixed;
    bottom: 80px;
    right: 16px;
    width: 52px;
    height: 52px;
    background: #2d5a27;
    color: white;
    border: none;
    border-radius: 26px;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

/* ============================
   LOGIN SCREEN
============================ */
#screen-login {
    background: #2d5a27;
    align-items: center;
    justify-content: center;
}

.login-wrap {
    text-align: center;
    padding: 40px 32px;
    width: 100%;
}

.login-logo { font-size: 64px; margin-bottom: 12px; }
.login-title { color: white; font-size: 28px; font-weight: 700; margin-bottom: 32px; }

.login-form { display: flex; flex-direction: column; gap: 12px; }

.login-form input {
    padding: 14px 16px;
    border-radius: 12px;
    border: none;
    font-size: 16px;
    background: rgba(255,255,255,0.95);
}

.login-form button {
    padding: 14px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 4px;
}

.login-error {
    color: #ffcccc;
    font-size: 14px;
    min-height: 20px;
}

/* Offline banner pushes content down */
body.offline #app { padding-top: 36px; }

/* Show inactive toggle */
.show-inactive-wrap {
    padding: 6px 14px 6px;
    background: white;
    border-bottom: 1px solid #e0d8d0;
    font-size: 13px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.show-inactive-wrap input[type=checkbox] {
    accent-color: #2d5a27;
}
