/* ===== Base ===== */
* {
    -webkit-tap-highlight-color: transparent;
}

/* ===== Focus Ring ===== */
.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.4);
}

.focus-ring:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.4);
}

/* ===== Shared Form Components ===== */
.input-field {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    background: white;
    color: #1f2937;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}

.input-field:focus {
    outline: none;
    border-color: #ec4899;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.15);
}

.input-field::placeholder {
    color: #9ca3af;
}

.dark .input-field {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

.dark .input-field:focus {
    border-color: #f472b6;
    box-shadow: 0 0 0 3px rgba(244, 114, 182, 0.2);
}

.dark .input-field::placeholder {
    color: #6b7280;
}

/* ===== Primary Button ===== */
.btn-primary {
    background: linear-gradient(135deg, #ec4899, #db2777);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #db2777, #be185d);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(219, 39, 119, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* ===== Loading Indicator ===== */
#loadingIndicator {
    animation: progress 2s linear infinite;
}

/* ===== Chart Container (responsive) ===== */
.chart-container {
    position: relative;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Mobile: allow horizontal scroll with a min-width for readability */
@media (max-width: 640px) {
    .chart-container canvas {
        min-width: 500px;
        height: 220px !important;
    }
}

/* ===== Sakura Petal Animation ===== */
#petals-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.petal {
    position: absolute;
    top: -20px;
    opacity: 0;
    animation: fall linear infinite;
    border-radius: 50% 0 50% 50%;
}

@keyframes fall {
    0% {
        transform: translateY(0) rotate(0deg) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.7;
    }
    90% {
        opacity: 0.5;
    }
    100% {
        transform: translateY(105vh) rotate(720deg) translateX(80px);
        opacity: 0;
    }
}

/* ===== Mobile Bottom Navigation ===== */
.mobile-nav {
    display: none;
}

.mobile-nav-icon svg {
    width: 1.125rem;
    height: 1.125rem;
}

@media (max-width: 640px) {
    .mobile-nav {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid rgba(236, 72, 153, 0.15);
        z-index: 40;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .dark .mobile-nav {
        background: rgba(31, 41, 55, 0.95);
        border-top-color: rgba(75, 85, 99, 0.5);
    }

    body {
        padding-bottom: calc(4rem + env(safe-area-inset-bottom, 0px));
    }
}

/* ===== Scrollbar Styling ===== */
.chat-scroll::-webkit-scrollbar,
.chart-container::-webkit-scrollbar {
    height: 3px;
    width: 4px;
}

.chat-scroll::-webkit-scrollbar-track,
.chart-container::-webkit-scrollbar-track {
    background: transparent;
}

.chat-scroll::-webkit-scrollbar-thumb,
.chart-container::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 9999px;
}

.dark .chat-scroll::-webkit-scrollbar-thumb,
.dark .chart-container::-webkit-scrollbar-thumb {
    background: #4b5563;
}

/* Hide horizontal scrollbar on tab nav */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ===== Print ===== */
@media print {
    .no-print {
        display: none !important;
    }
}
