@tailwind base;
@tailwind components;
@tailwind utilities;

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

:root {
    --primary: #2F3C4C;
    --secondary: #FFFFFF;
    --accent: #BFC1C2;
    --text-primary: #2F3C4C;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
}

body {
    font-family: 'Roboto', Arial, sans-serif;
    color: var(--text-primary);
    background-color: var(--secondary);
    line-height: 1.6;
}

.bg-primary {
    background-color: var(--primary) !important;
}

.text-primary {
    color: var(--primary) !important;
}

.bg-secondary {
    background-color: var(--secondary) !important;
}

.bg-accent {
    background-color: var(--accent) !important;
}

input, textarea, select {
    border-color: var(--accent);
}

button:hover {
    opacity: 0.9;
}

/* Lucide icon styles */
i[data-lucide] {
    display: inline-block;
    vertical-align: middle;
    stroke: currentColor;
    stroke-width: 2;
}

.lucide-icon {
    width: 20px;
    height: 20px;
    margin-right: 4px;
    vertical-align: middle;
}

/* Top navigation: white background, primary color for all text and icons */
nav, header nav, .top-nav, .navbar {
    background-color: var(--secondary) !important;
    color: var(--primary) !important;
}

nav a, nav button, nav span, nav p, nav li, nav .nav-text {
    color: var(--primary) !important;
    fill: var(--primary) !important;
}

.mobile-nav a, .mobile-nav button, .mobile-nav span, .mobile-nav p, .mobile-nav li, .mobile-nav .nav-text {
    color: var(--primary) !important;
    fill: var(--primary) !important;
}

/* Ensure lucide icons inside navigation are dark (inherit nav color) instead of forced white */
nav i[data-lucide], header nav i[data-lucide], .mobile-nav i[data-lucide], .desktop-menu i[data-lucide] {
    stroke: var(--primary) !important;
    color: var(--primary) !important;
    fill: var(--primary) !important;
}

/* Mobile nav should also use white background (overrides earlier mobile rules) */
.mobile-nav {
    background-color: var(--secondary) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.08); /* subtle shadow to separate from page */
}

@media (max-width: 640px) {
    .mobile-nav {
        background-color: var(--secondary) !important;
    }
}

/* Search icon specific styles */
.search-icon {
    width: 18px;
    height: 18px;
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9CA3AF; /* gray-400 */
}

/* Navigation hover */
nav a:hover, nav button:hover {
    background-color: var(--text-secondary);
}

/* Mobile menu styles */
.mobile-menu {
    display: none;
}

@media (max-width: 640px) {
    .desktop-menu {
        display: none;
    }
    .mobile-menu {
        display: block;
    }
    .mobile-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--primary);
        flex-direction: column;
        padding: 1rem;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        z-index: 50;
    }
    .mobile-nav a, .mobile-nav button {
        padding: 0.5rem;
        width: 100%;
        text-align: left;
    }
    .mobile-nav .user-dropdown {
        position: static;
        width: 100%;
        background-color: var(--secondary);
    }
}

/* Responsive button styles */
.primary-btn, .secondary-btn {
    padding: 10px 20px;
    font-size: 14px;
}

@media (min-width: 640px) {
    .primary-btn, .secondary-btn {
        padding: 12px 24px;
        font-size: 16px;
    }
}

/* Button styles */
.primary-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: all 0.3s ease;
}

.primary-btn:hover {
    background-color: #1e2832;
    transform: translateY(-2px);
}

.secondary-btn {
    background-color: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background-color: var(--primary);
    color: #FFFFFF;
}

/* Card styles */
.card {
    background: white;
    border-radius: 16px;
    padding: 16px;
    transition: transform 0.3s ease;
}

@media (min-width: 640px) {
    .card {
        padding: 24px;
    }
}

.card:hover {
    transform: translateY(-4px);
}

/* Input field styles */
.input-field {
    width: 100%;
    padding: 10px 10px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    line-height: 24px;
    transition: border-color 0.3s ease;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
}

/* Line clamp for text truncation */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2; /* standard property for compatibility */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Section padding */
.section-padding {
    padding: 80px 0;
}

/* Container styles */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Hero gradient */
.hero-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, #1e2832 100%);
}

/* Category card styles */
.category-card {
    background: white;
    border: 2px solid var(--primary);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.category-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Treatment card styles */
.treatment-card {
    background: white;
    border: 2px solid var(--primary);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.treatment-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Breadcrumb styles */
nav ol {
    list-style: none;
}

/* Treatment details expansion */
.treatment-details {
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.treatment-details.show {
    max-height: 1000px; /* Adjust based on content */
    opacity: 1;
}

/* Back to categories link */
.back-link {
    transition: color 0.3s ease;
}

.back-link:hover {
    color: #1e2832;
}

/* Tooltip styles */
nav .tooltip-container:hover .tooltip {
    display: block;
}
.tooltip {
    display: none;
    position: absolute;
    background-color: #1F2937; /* gray-800 */
    color: white;
    font-size: 0.875rem; /* text-sm */
    padding: 0.25rem 0.5rem; /* px-2 py-1 */
    border-radius: 0.25rem; /* rounded */
    white-space: nowrap;
    z-index: 100;
    border: 1px solid white; /* White border */
}

/* Sidebar styles */
aside {
    transition: transform 0.3s ease;
}

@media (max-width: 767px) {
    aside {
        transform: translateX(-100%);
    }
    aside:not(.hidden) {
        transform: translateX(0);
    }
}

/* Chart container */
canvas {
    max-width: 100%;
}

/* Prescription upload form */
#upload-form input[type="file"] {
    padding: 8px;
    border: none;
}

/* Prescription status messages */
.text-yellow-600 {
    color: #D97706;
}
.text-green-600 {
    color: #059669;
}
.text-red-600 {
    color: #DC2626;
}

/* Categories container for shop page */
.categories-container {
    max-height: 400px; /* Fixed height */
    min-height: 200px; /* Prevent collapse */
    overflow-y: auto; /* Independent scrollbar */
    scroll-behavior: smooth; /* Smooth scrolling */
    overscroll-behavior: contain; /* Isolate scrolling */
    -webkit-overflow-scrolling: touch; /* Smooth iOS scrolling */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: var(--primary) var(--secondary); /* Use primary/secondary colors */
}

/* Webkit browsers (Chrome, Safari) */
.categories-container::-webkit-scrollbar {
    width: 8px;
}
.categories-container::-webkit-scrollbar-track {
    background: var(--secondary);
    border-radius: 4px;
    margin: 4px;
}
.categories-container::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}
.categories-container::-webkit-scrollbar-thumb:hover {
    background: #1e2832;
}

/* Sidebar stability */
aside#categories-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem; /* Match space-y-8 */
    max-height: 100%; /* Prevent stretch */
    overflow: hidden; /* Lock sidebar scrolling */
}

/* Main content stability */
main#shop-main {
    overflow: visible; /* Isolate main content */
    max-height: 100%; /* Prevent stretch */
}

/* Ensure button visibility */
.select-option-btn {
    display: block !important;
    visibility: visible !important;
}
.no-hover:hover {
    background: none !important;
    text-decoration: none !important;
    color: inherit !important;
}