/* ════════════════════════════════════════════════════
   mickael.photos/app/ — style.css
   Dashboard + Administration
════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════
   1. RESET
══════════════════════════════════════════════════ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* ══════════════════════════════════════════════════
   2. VARIABLES
══════════════════════════════════════════════════ */
:root {
    --sat: env(safe-area-inset-top,    20px);
    --sab: env(safe-area-inset-bottom, 20px);
    --accent:               #667EEA;
    --accent2:              #764BA2;
    --card:                 rgba(255,255,255,0.055);
    --border:               rgba(255,255,255,0.10);
    --muted:                rgba(255,255,255,0.42);
    --color-success:        #34C759;
    --color-success-bg:     rgba(52,199,89,0.14);
    --color-success-border: rgba(52,199,89,0.30);
    --color-danger:         #FF3B30;
    --color-danger-bg:      rgba(255,59,48,0.14);
    --color-danger-border:  rgba(255,59,48,0.30);
    --color-warning:        #FF9F0A;
}

/* ══════════════════════════════════════════════════
   3. HTML & BODY
══════════════════════════════════════════════════ */
html {
    height: -webkit-fill-available;
}

body {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(160deg, #0f0c29 0%, #302b63 55%, #24243e 100%);
    background-attachment: fixed;
    color: #fff;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body.page-dashboard {
    padding-top:    calc(var(--sat) + 16px);
    padding-bottom: calc(var(--sab) + 28px);
}

body.page-admin {
    padding-bottom: calc(var(--sab) + 30px);
}

/* ══════════════════════════════════════════════════
   4. DASHBOARD — HEADER
══════════════════════════════════════════════════ */
.header {
    text-align: center;
    padding: 22px 16px 10px;
    position: relative;
}

.clock {
    font-size: 72px;
    font-weight: 100;
    letter-spacing: -4px;
    line-height: 1;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.date-line {
    font-size: 16px;
    color: rgba(255,255,255,0.62);
    margin-top: 5px;
    text-transform: capitalize;
}

.subtitle-line {
    font-size: 13px;
    color: rgba(255,255,255,0.36);
    margin-top: 3px;
}

.admin-btn {
    position: absolute;
    top: 24px;
    right: 16px;
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    text-decoration: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.1s, background 0.1s;
}

.admin-btn:active {
    background: rgba(255,255,255,0.2);
    transform: scale(0.9);
}

/* ══════════════════════════════════════════════════
   5. DASHBOARD — CATÉGORIES & SÉPARATEURS
══════════════════════════════════════════════════ */
.divider {
    height: 1px;
    background: rgba(255,255,255,0.07);
    margin: 6px 16px;
}

.cat-header {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.33);
    text-transform: uppercase;
    letter-spacing: 1.3px;
    padding: 10px 20px 2px;
}

/* ══════════════════════════════════════════════════
   6. DASHBOARD — GRILLE D'APPLICATIONS
══════════════════════════════════════════════════ */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px 8px;
    padding: 14px 16px;
    max-width: 400px;
    margin: 0 auto;
}

.app-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    cursor: pointer;
}

.app-card:active .app-icon {
    transform: scale(0.85);
    opacity: 0.68;
}

.app-icon {
    width: 76px;
    height: 76px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.38);
    transition: transform 0.12s cubic-bezier(0.36,.07,.19,.97), opacity 0.12s;
    position: relative;
    overflow: hidden;
}

.app-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, rgba(255,255,255,0.22) 0%, transparent 55%);
    border-radius: 20px;
    pointer-events: none;
}

.app-name {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255,255,255,0.9);
    text-align: center;
    max-width: 76px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 1px 4px rgba(0,0,0,0.55);
}

/* ══════════════════════════════════════════════════
   7. DASHBOARD — ÉTAT VIDE
══════════════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: rgba(255,255,255,0.35);
}

.empty-state .ico {
    font-size: 58px;
    margin-bottom: 14px;
}

.empty-state h2 {
    font-size: 17px;
    font-weight: 500;
    color: rgba(255,255,255,0.5);
    margin-bottom: 7px;
}

.empty-state p {
    font-size: 14px;
    line-height: 1.6;
}

/* ══════════════════════════════════════════════════
   8. ADMIN — TOPBAR
══════════════════════════════════════════════════ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(var(--sat) + 14px) 16px 14px;
    background: rgba(15,12,41,0.75);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.topbar-title {
    font-size: 17px;
    font-weight: 600;
}

.btn-back {
    color: var(--accent);
    font-size: 15px;
    text-decoration: none;
    padding: 6px 0;
}

.btn-back:active { opacity: 0.6; }

.btn-logout {
    background: none;
    border: none;
    color: rgba(255,90,80,0.85);
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    padding: 6px 0;
}

.btn-logout:active { opacity: 0.6; }

/* ══════════════════════════════════════════════════
   9. ADMIN — LAYOUT
══════════════════════════════════════════════════ */
.wrap {
    padding: 16px;
    max-width: 520px;
    margin: 0 auto;
}

.section {
    margin-bottom: 28px;
}

.sec-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 0 4px;
    margin-bottom: 10px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.empty-card {
    padding: 22px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

/* ══════════════════════════════════════════════════
   10. ADMIN — LIGNE APPLICATION
══════════════════════════════════════════════════ */
.app-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
}

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

.row-icon {
    width: 48px;
    height: 48px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 23px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.row-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, rgba(255,255,255,0.2) 0%, transparent 55%);
}

.row-info { flex: 1; min-width: 0; }

.row-name {
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.row-url {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.row-badge {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    display: inline-block;
    margin-top: 4px;
}

.badge-on  { background: var(--color-success-bg); color: var(--color-success); }
.badge-off { background: var(--color-danger-bg);  color: var(--color-danger); }

.row-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-end;
    flex-shrink: 0;
}

.row-btns { display: flex; gap: 5px; }

/* ══════════════════════════════════════════════════
   11. ADMIN — BOUTONS MINI
══════════════════════════════════════════════════ */
.btn-mini {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    font-family: inherit;
    min-height: 32px;
}

.btn-mini:active { opacity: 0.55; }

.btn-edit   { color: #5AC8FA;              border-color: rgba(90,200,250,0.25); }
.btn-del    { color: var(--color-danger);  border-color: var(--color-danger-border); }
.btn-toggle { color: var(--color-warning); border-color: rgba(255,159,10,0.25); }

/* ══════════════════════════════════════════════════
   12. ADMIN — FORMULAIRE
══════════════════════════════════════════════════ */
.form-row {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
}

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

label.lbl {
    font-size: 12px;
    color: var(--muted);
    display: block;
    margin-bottom: 5px;
}

.inp {
    width: 100%;
    background: rgba(255,255,255,0.055);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
    padding: 10px 12px;
    outline: none;
    -webkit-appearance: none;
    font-family: inherit;
}

.inp:focus {
    border-color: var(--accent);
    background: rgba(102,126,234,0.1);
}

.inp::placeholder { color: rgba(255,255,255,0.22); }

.color-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-row input[type=color] {
    width: 46px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: none;
    cursor: pointer;
    padding: 3px;
    flex-shrink: 0;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
}

.check-row input[type=checkbox] {
    width: 22px;
    height: 22px;
    accent-color: var(--accent);
    cursor: pointer;
}

.check-row label { font-size: 15px; cursor: pointer; }

.icon-preview {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 27px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    transition: background 0.3s;
}

.icon-preview::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, rgba(255,255,255,0.2) 0%, transparent 55%);
}

/* ══════════════════════════════════════════════════
   13. ADMIN — BOUTON PRINCIPAL
══════════════════════════════════════════════════ */
.btn-main {
    display: block;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none;
    border-radius: 13px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.2px;
}

.btn-main:active { opacity: 0.8; }

.cancel-link {
    display: block;
    text-align: center;
    margin-top: 10px;
    font-size: 14px;
    color: var(--muted);
    text-decoration: none;
}

.cancel-link:active { color: #fff; }

/* ══════════════════════════════════════════════════
   14. ADMIN — MESSAGES FLASH
══════════════════════════════════════════════════ */
.flash {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 16px;
    border: 1px solid;
}

.flash-ok {
    background: var(--color-success-bg);
    color: var(--color-success);
    border-color: var(--color-success-border);
}

.flash-error {
    background: var(--color-danger-bg);
    color: #FF6B6B;
    border-color: var(--color-danger-border);
}

/* ══════════════════════════════════════════════════
   15. ADMIN — PAGE DE CONNEXION
══════════════════════════════════════════════════ */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
}

.login-logo  { font-size: 62px; margin-bottom: 10px; }
.login-title { font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.login-sub   { font-size: 14px; color: var(--muted); margin-bottom: 28px; }

.login-box {
    width: 100%;
    max-width: 340px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 22px;
}

.login-box .inp { margin-bottom: 14px; }

.login-home {
    margin-top: 22px;
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
    display: block;
}

.login-home:active { color: #fff; }
