/* DLM Network PWA — Mobile-first stylesheet */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --dlm-blue: #1a3a6b;
    --dlm-gold: #c8a84b;
    --dlm-bg: #f4f6f9;
    --dlm-white: #ffffff;
    --dlm-text: #1a1a2e;
    --dlm-muted: #6b7280;
    --dlm-border: #e5e7eb;
    --dlm-error: #dc2626;
    --dlm-radius: 12px;
    --dlm-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--dlm-bg);
    color: var(--dlm-text);
    font-size: 16px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

#app {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    max-width: 480px;
    margin: 0 auto;
    background: var(--dlm-white);
}

/* ── Header ── */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--dlm-blue);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-header h1 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.lang-toggle {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 600;
}

/* ── Login page ── */
.login-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 24px 24px;
    gap: 8px;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: var(--dlm-blue);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.login-logo svg { width: 48px; height: 48px; fill: var(--dlm-gold); }

.login-title { font-size: 1.5rem; font-weight: 700; color: var(--dlm-blue); text-align: center; }
.login-sub { font-size: 0.9rem; color: var(--dlm-muted); text-align: center; margin-bottom: 16px; }

/* ── Forms ── */
.field { width: 100%; display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--dlm-text); }

.phone-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.country-code {
    flex-shrink: 0;
    padding: 12px 10px;
    border: 1.5px solid var(--dlm-border);
    border-radius: var(--dlm-radius);
    background: var(--dlm-bg);
    font-size: 1rem;
    color: var(--dlm-text);
}

input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--dlm-border);
    border-radius: var(--dlm-radius);
    font-size: 1rem;
    background: var(--dlm-white);
    color: var(--dlm-text);
    transition: border-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--dlm-blue);
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 4px 0;
}

.checkbox-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: var(--dlm-blue);
    cursor: pointer;
}

.checkbox-label { display: flex; flex-direction: column; }
.checkbox-label span { font-size: 0.95rem; font-weight: 500; }
.checkbox-label small { font-size: 0.78rem; color: var(--dlm-muted); }

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--dlm-blue);
    color: #fff;
    border: none;
    border-radius: var(--dlm-radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: opacity 0.15s;
    margin-top: 8px;
}
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary:active:not(:disabled) { opacity: 0.85; }

.error-msg {
    color: var(--dlm-error);
    font-size: 0.85rem;
    padding: 8px 12px;
    background: #fef2f2;
    border-radius: 8px;
    border: 1px solid #fecaca;
    width: 100%;
}

.profile-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--dlm-border);
    margin-top: 4px;
}

.profile-form h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dlm-blue);
}

/* ── Install banner ── */
.install-banner {
    background: var(--dlm-blue);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
}

.install-banner button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    white-space: nowrap;
}

/* ── Library ── */
.library-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.library-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--dlm-border);
    background: var(--dlm-white);
}

.library-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    flex: 1;
}

.btn-back {
    background: none;
    border: none;
    color: var(--dlm-blue);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    white-space: nowrap;
}

.btn-logout {
    background: none;
    border: none;
    color: var(--dlm-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 8px;
}

.card-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--dlm-border);
}

.card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--dlm-white);
    cursor: pointer;
    transition: background 0.1s;
    text-decoration: none;
    color: inherit;
}
.card:active { background: var(--dlm-bg); }

.card-thumb {
    width: 72px;
    height: 54px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--dlm-border);
    flex-shrink: 0;
}

.card-thumb-placeholder {
    width: 72px;
    height: 54px;
    border-radius: 8px;
    background: var(--dlm-blue);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-thumb-placeholder svg { width: 28px; height: 28px; fill: rgba(255,255,255,0.5); }

.card-info { flex: 1; min-width: 0; }
.card-title { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { font-size: 0.8rem; color: var(--dlm-muted); margin-top: 2px; }
.card-chevron { color: var(--dlm-muted); font-size: 1.1rem; flex-shrink: 0; }

/* ── Video player ── */
.player-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #000;
}

.yt-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background: #000;
}

.yt-container iframe,
#yt-player {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.video-info {
    background: var(--dlm-white);
    padding: 16px;
    flex: 1;
}

.video-info h3 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.video-info p { font-size: 0.85rem; color: var(--dlm-muted); }

.yt-fallback {
    display: block;
    text-align: center;
    padding: 8px;
    color: var(--dlm-blue);
    font-size: 0.85rem;
    text-decoration: none;
    font-weight: 500;
}

/* ── Loading / empty states ── */
.skeleton-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--dlm-white);
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
    border-radius: 6px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-thumb { width: 72px; height: 54px; border-radius: 8px; flex-shrink: 0; }
.skeleton-line { height: 14px; flex: 1; }
.skeleton-line-short { height: 11px; width: 60%; margin-top: 6px; }

.empty-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    color: var(--dlm-muted);
    font-size: 0.9rem;
    text-align: center;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--dlm-border);
    border-top-color: var(--dlm-blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 40px auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

.login-loading { display: flex; justify-content: center; padding: 12px 0; }
