/* Liquid Glass Keyframes & Apple HIG Theme System */
:root {
    /* Liquid Glass Color Palette - Light Theme */
    --apple-blue: #007AFF;
    --apple-blue-dark: #0056CC;
    --apple-green: #34C759;
    --apple-red: #FF3B30;
    --apple-orange: #FF9500;
    --apple-gray-1: rgba(0, 0, 0, 0.5);
    --apple-gray-2: rgba(0, 0, 0, 0.4);
    --apple-gray-3: rgba(0, 0, 0, 0.3);
    --apple-gray-4: rgba(0, 0, 0, 0.2);
    --apple-gray-5: rgba(0, 0, 0, 0.1);
    --apple-gray-6: rgba(0, 0, 0, 0.05);
    
    --apple-bg: #f5f5f7;
    --apple-glass-bg: rgba(255, 255, 255, 0.65);
    --apple-card-bg: rgba(255, 255, 255, 0.75);
    --apple-text: #1d1d1f;
    --apple-text-secondary: #86868b;
    
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-border-solid: #E5E5EA;
    --glass-glow: rgba(255, 255, 255, 0.3);
    
    /* Shadows */
    --bento-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --bento-shadow-hover: 0 16px 48px rgba(0, 0, 0, 0.12);
}

/* Dark Theme Variables */
html[data-theme="dark"] {
    --apple-bg: #000000;
    --apple-glass-bg: rgba(28, 28, 30, 0.65);
    --apple-card-bg: rgba(44, 44, 46, 0.75);
    --apple-text: #f5f5f7;
    --apple-text-secondary: #a1a1a6;
    
    --apple-gray-1: rgba(255, 255, 255, 0.5);
    --apple-gray-2: rgba(255, 255, 255, 0.4);
    --apple-gray-3: rgba(255, 255, 255, 0.3);
    --apple-gray-4: rgba(255, 255, 255, 0.2);
    --apple-gray-5: rgba(255, 255, 255, 0.1);
    --apple-gray-6: rgba(255, 255, 255, 0.05);
    
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-border-solid: #3a3a3c;
    --glass-glow: rgba(255, 255, 255, 0.05);
    
    --bento-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --bento-shadow-hover: 0 16px 48px rgba(0, 0, 0, 0.6);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
    background-color: var(--apple-bg);
    color: var(--apple-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
}

/* Bento Card Style */
.bento-card {
    background: var(--apple-card-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--bento-shadow);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.bento-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: var(--bento-shadow-hover);
}

.bento-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

/* Gemini Dark Mode Toggle Style */
.gemini-toggle {
    width: 60px;
    height: 32px;
    border-radius: 40px;
    background: var(--apple-gray-5);
    border: 1px solid var(--glass-border);
    position: relative;
    cursor: pointer;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background 0.4s ease;
    display: flex;
    align-items: center;
    padding: 0 4px;
    justify-content: space-between;
}

html[data-theme="dark"] .gemini-toggle {
    background: #007AFF; /* Deep sleek blue on dark state */
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

.gemini-toggle .toggle-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    position: absolute;
    left: 4px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FF9500;
}

html[data-theme="dark"] .gemini-toggle .toggle-thumb {
    transform: translateX(28px);
    background: #1c1c1e;
    color: #ffffff;
}

.gemini-toggle svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    transition: opacity 0.3s ease, transform 0.5s ease;
}

/* Floating Navigation Bar (Master Link) */
.global-floating-nav {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--apple-glass-bg);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border: 1px solid var(--glass-border);
    padding: 8px 16px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    z-index: 9999;
}

.global-floating-nav a {
    text-decoration: none;
    color: var(--apple-text);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    transition: background 0.2s ease;
}

.global-floating-nav a:hover {
    background: var(--apple-gray-5);
}

.global-floating-nav a.active {
    background: var(--apple-text);
    color: var(--apple-bg);
}

.svg-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Footer Theme Toggle */
.global-footer-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 12px;
}

.global-footer-toggle .rgpd-btn {
    width: 32px;
    height: 32px;
    background: var(--apple-glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--apple-text);
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, background 0.2s ease;
}

.global-footer-toggle .rgpd-btn:hover {
    transform: scale(1.05);
    background: var(--apple-gray-5);
}

.global-footer-toggle .rgpd-btn.active {
    background: var(--apple-text);
    color: var(--apple-bg);
}

.global-footer-toggle .rgpd-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.global-footer-toggle .gemini-toggle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--apple-glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease;
}

.global-footer-toggle .gemini-toggle:hover {
    transform: scale(1.05);
}

.global-footer-toggle .gemini-toggle svg {
    width: 16px;
    height: 16px;
    fill: var(--apple-text);
}

.global-footer-toggle .toggle-thumb {
    display: none;
}

/* Responsive Hub Bar - Icons only on smaller screens or when hub-icons-only class is present on body */
@media (max-width: 600px) {
    .global-floating-nav {
        padding: 6px 10px !important;
        gap: 8px !important;
    }
    
    .global-floating-nav a {
        padding: 6px !important;
        font-size: 0 !important;
        gap: 0 !important; /* Remove gap to ensure icon centering */
        justify-content: center;
    }
    
    .global-floating-nav a .svg-icon {
        width: 20px !important;
        height: 20px !important;
    }
    
    .gemini-toggle {
        padding: 4px !important;
    }
    
    .gemini-toggle .toggle-thumb {
        display: none !important;
    }
    
    .gemini-toggle svg {
        width: 20px !important;
        height: 20px !important;
    }
}

/* Hub bar: laisse déborder le menu ouvert de la pillule (pas de clipping) */
.global-floating-nav { overflow: visible; }
/* Pillule ouverte = EXTENSION HORIZONTALE de la hub bar (icônes en ligne) */
.hub-pill-auto.open {
    width: auto;
    height: 40px;
    overflow: visible;
    border-radius: 50%;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    flex-direction: row;
    align-items: center;
    gap: 4px;
}
.hub-pill-auto.open .actions-inner {
    display: flex;
    flex-direction: row;          /* icônes côte à côte: la barre s'étend */
    align-items: center;
    gap: 4px;
    width: auto;
    height: 30px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 0;
    opacity: 1;
    transform: none;
}
.hub-pill-auto.open .actions-inner > * { flex: none; }
/* Le filet RGPD: dans la rangée, séparation verticale */
.hub-pill-auto.open .actions-inner .global-footer-toggle {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    border-top: none;
    border-left: 1px solid var(--glass-border, rgba(0,0,0,0.1));
    margin: 0 0 0 2px;
    padding: 0 0 0 4px;
    width: auto;
    height: 30px;
}
/* Le rail se déroule SOUS la barre: le conteneur .open ne contient que le
   trigger; le rail (actions-inner) est placé en absolu sous la pillule */

.global-floating-nav { position: fixed; }

/* Force icons-only mode if body has .hub-icons-only class */
body.hub-icons-only .global-floating-nav {
    padding: 6px 10px !important;
    gap: 8px !important;
}

body.hub-icons-only .global-floating-nav a {
    padding: 6px !important;
    font-size: 0 !important;
    gap: 0 !important;
    justify-content: center;
}

body.hub-icons-only .global-floating-nav a .svg-icon {
    width: 20px !important;
    height: 20px !important;
}

@media (max-width: 400px) {
    .global-floating-nav {
        padding: 4px 8px;
        gap: 4px;
    }
    
    .global-floating-nav a {
        padding: 4px;
    }
}

/* SVG Animations applied via CSS */
@keyframes spin-slow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse-soft {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

@keyframes float-up-down {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

.anim-spin:hover svg { animation: spin-slow 4s linear infinite; }
.anim-pulse:hover svg { animation: pulse-soft 2s ease-in-out infinite; }
.anim-float:hover svg { animation: float-up-down 2s ease-in-out infinite; }

/* Global Utilities */
h1, h2, h3 { font-weight: 600; letter-spacing: -0.5px; }
.text-secondary { color: var(--apple-text-secondary); }

/* === Fix mobile: pillule vs éléments locaux des apps === */
@media (max-width: 640px) {
    .global-floating-nav {
        top: 10px;
        padding: 6px 10px;
        max-width: calc(100vw - 130px);
    }
    .global-floating-nav .nav-item {
        padding: 8px 10px;
        font-size: 12px;
    }
}


/* Badge EOD: point vert sur l'item Close quand l'EOD du jour est sauvegardé */
.eod-badge {
  position: absolute;
  top: 6px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--apple-green, #34c759);
  box-shadow: 0 0 4px rgba(52, 199, 89, 0.6);
}
.global-floating-nav .nav-item { position: relative; }


/* === Pillule hamburger universelle — DANS la hub bar, tout à droite === */
.hub-pill-auto {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    overflow: hidden;
    border-radius: 50%;
    background: transparent;
    border: none;
    box-shadow: none;
    flex: none;
}
.hub-pill-auto .actions-trigger {
    width: 30px;
    height: 30px;
    flex: none;
    position: relative;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--apple-text, #1d1d1f);
    cursor: pointer;
}
.hub-pill-auto .actions-trigger i {
    display: block !important;
    font-size: 14px;
    line-height: 1;
}
.hub-pill-auto .actions-inner { display: none; }

/* Ouverte: EXTENSION HORIZONTALE (identique à Mac-in-hub) */
.hub-pill-auto.open {
    width: auto;
    height: 40px;
    overflow: visible;
    border-radius: 50%;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    flex-direction: row;
    align-items: center;
    gap: 4px;
}
.hub-pill-auto.open .actions-inner {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    width: auto;
    height: 30px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 0;
    opacity: 1;
    transform: none;
    transition: none;
}
.hub-pill-auto.open .actions-inner > * { flex: none; }
.hub-pill-auto .global-footer-toggle {
    position: static;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    border-top: none;
    border-left: 1px solid var(--glass-border, rgba(0,0,0,0.1));
    margin: 0 0 0 2px;
    padding: 0 0 0 4px;
    width: auto;
    height: 30px;
}
.hub-pill-auto .rgpd-btn,
.hub-pill-auto .gemini-toggle {
    width: 30px;
    height: 30px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    color: var(--apple-text, #1d1d1f);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.hub-pill-auto .rgpd-btn svg,
.hub-pill-auto .gemini-toggle svg {
    width: 15px;
    height: 15px;
    fill: var(--apple-text, #1d1d1f);
}
.hub-pill-auto .gemini-toggle .toggle-thumb { display: none !important; }
@media (max-width: 400px) {
    .hub-pill-auto { width: 36px; height: 36px; }
}


/* === Pillule .header-actions intégrée dans la hub bar (Mac) —
       extension HORIZONTALE: au clic la hub bar s'étend latéralement === */
.global-floating-nav .header-actions {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    overflow: visible;
    border-radius: 50%;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    flex: none;
}
.global-floating-nav .header-actions .actions-trigger {
    width: 30px;
    height: 30px;
    flex: none;
    position: relative;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--apple-text, #1d1d1f);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 0;
}
.global-floating-nav .header-actions .actions-trigger i {
    display: block !important;
    font-size: 14px;
    line-height: 1;
}
.global-floating-nav .header-actions .actions-trigger::before {
    content: "";
    display: block;
    width: 16px;
    height: 12px;
    position: absolute;
    top: calc(50% - 6px);
    left: calc(50% - 8px);
    background:
      linear-gradient(var(--apple-text, #1d1d1f), var(--apple-text, #1d1d1f)) 0 0 / 100% 2px no-repeat,
      linear-gradient(var(--apple-text, #1d1d1f), var(--apple-text, #1d1d1f)) 0 5px / 100% 2px no-repeat,
      linear-gradient(var(--apple-text, #1d1d1f), var(--apple-text, #1d1d1f)) 0 10px / 100% 2px no-repeat;
}
.global-floating-nav .header-actions .actions-inner { display: none; }
/* Ouverte: EXTENSION HORIZONTALE (icônes côte à côte dans la barre) */
.global-floating-nav .header-actions.open {
    width: auto;
    height: 40px;
    overflow: visible;
    border-radius: 50%;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    flex-direction: row;
    align-items: center;
    gap: 4px;
}
.global-floating-nav .header-actions.open .actions-inner {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    width: auto;
    height: 30px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 0;
    max-width: none;
    opacity: 1;
    transform: none;
    transition: none;
}
.global-floating-nav .header-actions.open .actions-inner > * { flex: none; }
.global-floating-nav .header-actions .actions-inner .btn-icon,
.global-floating-nav .header-actions .actions-inner .global-footer-toggle .rgpd-btn,
.global-floating-nav .header-actions .actions-inner .global-footer-toggle .gemini-toggle {
    width: 30px;
    height: 30px;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 13px;
    line-height: 1;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    color: var(--apple-text, #1d1d1f);
}
.global-floating-nav .header-actions .actions-inner .global-footer-toggle {
    position: static;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    border-top: none;
    border-left: 1px solid var(--glass-border, rgba(0,0,0,0.1));
    margin: 0 0 0 2px;
    padding: 0 0 0 4px;
    width: auto;
    height: 30px;
    background: transparent;
    box-shadow: none;
}
.global-floating-nav .header-actions .actions-inner .rgpd-btn svg,
.global-floating-nav .header-actions .actions-inner .gemini-toggle svg {
    width: 15px;
    height: 15px;
    fill: var(--apple-text, #1d1d1f);
}
.global-floating-nav .header-actions .actions-inner .gemini-toggle .toggle-thumb {
    display: none !important;
}

/* === XS/iPhone: hub bar + extension = UNE SEULE LIGNE garantie === */
@media (max-width: 640px) {
    .global-floating-nav {
        flex-wrap: nowrap !important;
        max-width: calc(100vw - 16px);
        justify-content: flex-start;
    }
    .global-floating-nav .nav-item,
    .global-floating-nav a {
        padding: 4px !important;
        font-size: 0 !important;
    }
    .global-floating-nav .nav-item .svg-icon,
    .global-floating-nav a .svg-icon {
        width: 18px !important;
        height: 18px !important;
    }
    .global-floating-nav .hub-pill-auto,
    .global-floating-nav .header-actions {
        width: 36px;
        height: 36px;
    }
    .global-floating-nav .hub-pill-auto .actions-trigger,
    .global-floating-nav .header-actions .actions-trigger {
        width: 28px;
        height: 28px;
    }
    .global-floating-nav .header-actions.open .actions-inner .btn-icon,
    .global-floating-nav .header-actions.open .actions-inner .global-footer-toggle .rgpd-btn,
    .global-floating-nav .header-actions.open .actions-inner .global-footer-toggle .gemini-toggle,
    .hub-pill-auto.open .actions-inner .btn-icon,
    .hub-pill-auto.open .actions-inner .global-footer-toggle .rgpd-btn,
    .hub-pill-auto.open .actions-inner .global-footer-toggle .gemini-toggle {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }
    .global-floating-nav .header-actions.open .actions-inner,
    .hub-pill-auto.open .actions-inner {
        gap: 3px;
        height: 26px;
    }
}
