/* ============================================
   AST Client Gallery App — V1
   Anthony S. Torres Photography
   Base: AST steel blue (#50748a) + blue texture bg
   Fig Leaf theme: applied when category = boudoir
   Fonts: Lora (headings) + Noto Sans (body)
   ============================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;1,400&family=Noto+Sans:wght@400;600&display=swap');

/* ---------- CSS Variables: AST (default) ---------- */
:root {
    --primary:        #50748a;
    --primary-dark:   #3d5a6b;
    --primary-light:  #6a90a8;
    --accent:         #507f70;
    --text:           #222;
    --text-muted:     #666;
    --bg-card:        #ffffff;
    --bg-alt:         #f7f5f3;
    --border:         #ddd;
    --tag-bg:         #e8f0f4;
    --tag-text:       #50748a;
    --btn-bg:         #50748a;
    --btn-text:       #ffffff;
    --btn-hover:      #3d5a6b;
    --nav-bg:         #ffffff;
    --shadow:         0 2px 12px rgba(0,0,0,0.12);
}

/* ---------- CSS Variables: Fig Leaf (boudoir) ---------- */
.theme-figleaf {
    --primary:        #4a9a37;
    --primary-dark:   #3a7a2b;
    --primary-light:  #5db344;
    --accent:         #c4a07a;
    --tag-bg:         #eaf4e6;
    --tag-text:       #4a9a37;
    --btn-bg:         #4a9a37;
    --btn-hover:      #3a7a2b;
    --nav-bg:         #ffffff;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: 'Noto Sans', sans-serif;
    font-size: 16px;
    color: var(--text);
    background: url('../img/bg_bluetexture.jpg') no-repeat center center fixed;
    background-size: cover;
    background-color: #50748a;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Lora', serif;
    font-weight: normal;
    color: var(--text);
    margin-top: 0;
}
h1 { font-size: 2rem;    line-height: 1.2; margin-bottom: 1.25rem; }
h2 { font-size: 1.5rem;  line-height: 1.3; margin-bottom: 1rem; }
h3 { font-size: 1.25rem; line-height: 1.3; margin-bottom: .75rem; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }
p { line-height: 1.7; margin-top: 0; }

/* ---------- App Shell ---------- */
#AppShell {
    max-width: 480px;         /* mobile-first: feels like a real app */
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-card);
    box-shadow: 0 0 30px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
}

/* ---------- Nav / Header ---------- */
#AppNav {
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}
#AppNav .nav-logo img {
    height: 40px;
    width: auto;
}
#AppNav .nav-title {
    font-family: 'Lora', serif;
    font-size: 1rem;
    color: var(--text);
    font-style: italic;
}
#AppNav .nav-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    color: var(--text-muted);
    font-size: 1.2rem;
    line-height: 1;
    border-radius: 50%;
    transition: background 0.15s;
}
.btn-icon:hover { background: var(--bg-alt); color: var(--primary); }

/* ---------- Main Content ---------- */
#AppContent {
    flex: 1;
    padding: 1.25rem 1rem;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    background: var(--btn-bg);
    color: var(--btn-text);
    border: none;
    border-radius: 6px;
    padding: 0.65rem 1.25rem;
    font-family: 'Noto Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
}
.btn:hover  { background: var(--btn-hover); color: var(--btn-text); }
.btn:active { transform: scale(0.98); }
.btn-full   { width: 100%; display: block; }
.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.85rem; }

/* ---------- Login Card ---------- */
#LoginWrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
    background: url('../img/bg_bluetexture.jpg') no-repeat center center fixed;
    background-size: cover;
}
.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    text-align: center;
}
.login-card .logo { margin: 0 auto 1.5rem; }
.login-card .logo img { height: 60px; margin: 0 auto; }
.login-card h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.login-card p  { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.1rem; text-align: left; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem 0.85rem;
    font-family: 'Noto Sans', sans-serif;
    font-size: 0.95rem;
    color: var(--text);
    background: #fff;
    transition: border-color 0.15s;
    -webkit-appearance: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(80,116,138,0.15);
}
.form-error { color: #c0392b; font-size: 0.85rem; margin-top: 0.75rem; }

/* ---------- Session Cards (gallery index) ---------- */
.session-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.session-card {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    background: var(--bg-card);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.15s, box-shadow 0.15s;
}
.session-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    color: inherit;
}
.session-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
    background: var(--bg-alt);
}
.session-thumb-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 2rem;
}
.session-info {
    padding: 0.85rem 1rem;
}
.session-info h3 {
    font-size: 1rem;
    margin-bottom: 0.2rem;
}
.session-info .session-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.session-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    background: var(--tag-bg);
    color: var(--tag-text);
    margin-bottom: 0.4rem;
}

/* ---------- Photo Grid (session view) ---------- */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    margin-bottom: 1.5rem;
}
.photo-grid img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.15s;
}
.photo-grid img:hover { opacity: 0.88; }

/* ---------- Lightbox ---------- */
#Lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
#Lightbox.active { display: flex; }
#Lightbox img {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
}
#LightboxClose {
    position: absolute;
    top: 1rem; right: 1rem;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    width: 40px; height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
#LightboxPrev, #LightboxNext {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.15);
    border: none; color: #fff;
    font-size: 1.5rem;
    width: 44px; height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
#LightboxPrev { left: 0.75rem; }
#LightboxNext { right: 0.75rem; }

/* ---------- Video Section ---------- */
.video-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.video-item h4 { font-size: 0.9rem; margin-bottom: 0.4rem; color: var(--text-muted); }
.video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}
.video-embed iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 0;
}

/* ---------- Client Note (footer) ---------- */
.client-note {
    margin-top: 2rem;
    padding: 1rem;
    background: var(--bg-alt);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.6;
}
.client-note p { margin: 0 0 0.5rem; }
.client-note p:last-child { margin: 0; }

/* ---------- Lock Screen ---------- */
#LockOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    z-index: 900;
    align-items: center;
    justify-content: center;
}
#LockOverlay.active { display: flex; }
.lock-card {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    max-width: 300px;
    width: 90%;
}
.lock-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.lock-card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.25rem; }

/* ---------- Empty States ---------- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state p { font-size: 0.9rem; }

/* ---------- Install Banner ---------- */
#InstallBanner {
    display: none; /* shown via JS when appropriate */
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--primary);
    color: #fff;
    border-radius: 10px;
    padding: 0.9rem 1rem;
    margin-bottom: 1.25rem;
}
#InstallBanner.visible { display: flex; }
.install-banner-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.875rem;
    line-height: 1.3;
}
.install-banner-text strong { font-size: 0.95rem; }
.install-banner-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
#InstallBanner .btn { background: #fff; color: var(--primary); font-weight: 600; }
#InstallBanner .btn:hover { background: #f0f0f0; }
#InstallBanner .btn-icon { color: rgba(255,255,255,0.8); font-size: 1rem; }

/* ---------- Client Banner ---------- */
.client-banner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    background: #fffbf0;
    border: 1px solid #f0c84a;
    border-left: 4px solid #e8a012;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #5a4a00;
    opacity: 1;
    transition: opacity 0.3s ease;
}
.client-banner button {
    background: none;
    border: none;
    cursor: pointer;
    color: #b08a00;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ---------- Install Instructions Modal ---------- */
#InstallModal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 600;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: env(safe-area-inset-bottom);
}
#InstallModal.visible { display: flex; }
.ios-modal-card {
    background: #fff;
    border-radius: 16px 16px 0 0;
    padding: 1.75rem 1.5rem 2rem;
    width: 100%;
    max-width: 480px;
}
.ios-modal-card h3 { margin: 0 0 1rem; font-size: 1.15rem; }
.ios-steps {
    padding-left: 1.25rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.5;
}
.ios-icon {
    display: inline-block;
    font-size: 1.4rem;
    vertical-align: middle;
    margin-top: 0.2rem;
}

/* ---------- Toast / Flash ---------- */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: #222;
    color: #fff;
    padding: 0.65rem 1.25rem;
    border-radius: 6px;
    font-size: 0.875rem;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ---------- Greeting ---------- */
.gallery-greeting {
    margin-bottom: 1.5rem;
}
.gallery-greeting h2 {
    font-style: italic;
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
}
.gallery-greeting p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
}

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }

/* ---------- Responsive: allow wider on tablet/desktop ---------- */
@media (min-width: 640px) {
    #AppShell { max-width: 540px; }
    .photo-grid { grid-template-columns: repeat(3, 1fr); }
}
