/* Dnevnik Plakanja — Custom CSS (v2: sliders, mobile-first) */

/* Font families */
.font-heading {
    font-family: 'Poppins', sans-serif;
}

/* Smooth transitions for dark mode */
* {
    transition-property: background-color, border-color, color;
    transition-duration: 200ms;
    transition-timing-function: ease;
}

/* ── PWA: hide install section when running as standalone app ── */
@media (display-mode: standalone) {
    #pwa-footer-install { display: none !important; }
}

/* ── Active filter chip ── */
.active-chip {
    background-color: #f43f5e !important;
    border-color: #f43f5e !important;
    color: #fff !important;
}

/* ── Admin tab active ── */
.active-tab {
    background-color: #f43f5e;
    color: #fff;
}

/* ── Slider / Segmented Control ── */
.slider-track {
    display: flex !important;
    gap: 4px;
    background-color: #fce4ec !important;
    border-radius: 16px !important;
    padding: 5px !important;
    position: relative;
    border: 1px solid #fecdd3;
}

.dark .slider-track {
    background-color: #1e293b !important;
    border-color: #334155;
}

.slider-track > button.slider-option {
    flex: 1 1 0%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 14px 8px;
    border-radius: 12px !important;
    border: none !important;
    background-color: transparent !important;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: #9ca3af;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    line-height: 1.2;
    min-width: 0;
}

.slider-track > button.slider-option:hover {
    color: #fb7185;
    background-color: rgba(255, 255, 255, 0.5) !important;
}

.slider-track > button.slider-option.active {
    background-color: #fff !important;
    color: #e11d48 !important;
    box-shadow: 0 2px 12px rgba(244, 63, 94, 0.2), 0 0 0 1px rgba(244, 63, 94, 0.1);
    transform: scale(1.02);
}

.dark .slider-track > button.slider-option.active {
    background-color: rgba(244, 63, 94, 0.18) !important;
    color: #fb7185 !important;
    box-shadow: 0 2px 12px rgba(244, 63, 94, 0.12);
}

.slider-track > button.slider-option svg,
.slider-track > button.slider-option i {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* Responsive slider text */
@media (max-width: 380px) {
    .slider-track > button.slider-option {
        padding: 10px 4px;
        font-size: 0.7rem;
        gap: 3px;
    }
    .slider-track > button.slider-option svg,
    .slider-track > button.slider-option i {
        width: 20px;
        height: 20px;
    }
}

/* ── Info tooltip ── */
.info-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #fecdd3;
    color: #e11d48;
    border: none;
    cursor: pointer;
    font-size: 0;
    flex-shrink: 0;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    vertical-align: middle;
    margin-left: 4px;
}

.info-toggle:hover {
    background-color: #fda4af;
    transform: scale(1.1);
}

.info-toggle svg {
    width: 13px;
    height: 13px;
}

.dark .info-toggle {
    background-color: rgba(244, 63, 94, 0.2);
    color: #fb7185;
}

.info-bubble {
    display: none;
    margin-top: 8px;
    margin-bottom: 4px;
    padding: 12px 14px;
    border-radius: 12px;
    background-color: #fff5f5;
    border: 1px solid #fecdd3;
    font-size: 0.8rem;
    line-height: 1.5;
    color: #6b7280;
}

.info-bubble.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

.dark .info-bubble {
    background-color: #1e293b;
    border-color: #334155;
    color: #9ca3af;
}

.info-bubble strong {
    color: #e11d48;
    font-weight: 600;
}

.dark .info-bubble strong {
    color: #fb7185;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Scrollbar styling ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #fda4af;
    border-radius: 999px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #374151;
}

/* ── Focus visible for accessibility ── */
:focus-visible {
    outline: 2px solid #fb7185;
    outline-offset: 2px;
    border-radius: 8px;
}

/* ── Date input ── */
input[type="date"] {
    position: relative;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.4) sepia(1) saturate(5) hue-rotate(320deg);
    cursor: pointer;
    opacity: 0.7;
    padding: 2px;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.dark input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7) sepia(1) saturate(3) hue-rotate(320deg);
}

/* ── Select arrow for custom dropdown ── */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 20px;
}

/* ── Form card ── */
#entry-form {
    border: 1px solid #fecdd3;
}

.dark #entry-form {
    border-color: #334155;
}

/* ── Animations ── */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Toast animation */
#toast-container > div {
    animation: slideIn 0.3s ease forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Spin animation for loading */
@keyframes spin {
    to { transform: rotate(360deg); }
}
.animate-spin {
    animation: spin 1s linear infinite;
}

/* ── Prevent layout shift from scrollbar ── */
html {
    overflow-y: scroll;
}

/* ── Mobile bottom nav safe area ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    nav.fixed.bottom-0 {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ── PWA standalone mode adjustments ── */
@media (display-mode: standalone) {
    nav.fixed.bottom-0 {
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 4px);
    }
    /* Hide install prompt when already installed */
    .pwa-not-installed {
        display: none !important;
    }
}

/* ── Scroll reveal animations ── */
.scroll-reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}
.scroll-reveal:nth-child(even) {
    transition-delay: 0.1s;
}

/* ── Mobile-first form enhancements ── */
@media (max-width: 640px) {
    body {
        -webkit-text-size-adjust: 100%;
    }
    
    input, select, textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .max-w-lg {
        padding-left: 0;
        padding-right: 0;
    }
}
