/* ── pharma.town — shared styles ── */

:root {
    --accent: #0ea5e9;
    --accent-hover: #0284c7;
    --accent-light: #e0f2fe;
    --accent-bg: #f0f9ff;
    --cross: #22c55e;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --bg: #ffffff;
    --bg-subtle: #f8fafc;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --radius: 10px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --header-h: 60px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ── Header ── */

header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    height: var(--header-h);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0;
}

.brand::before {
    content: "✚";
    color: var(--cross);
    font-size: 1.1rem;
    margin-right: 6px;
    font-weight: 700;
    line-height: 1;
}

nav {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

nav::-webkit-scrollbar { display: none; }

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 8px;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}

nav a:hover {
    color: var(--accent);
    background: var(--accent-light);
}

nav a.active {
    color: var(--accent);
    background: var(--accent-light);
    font-weight: 600;
}

/* ── Main ── */

main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px 48px;
}

/* ── Page Title ── */

.page-title {
    margin-bottom: 24px;
}

.page-title h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.page-title p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ── Search Box ── */

.search-box {
    position: relative;
    margin-bottom: 24px;
}

.search-box input {
    width: 100%;
    padding: 14px 18px 14px 48px;
    font-size: 1rem;
    font-family: inherit;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14,165,233,0.1);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") center/contain no-repeat;
    pointer-events: none;
}

/* ── Result Count ── */

.result-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    min-height: 24px;
}

.result-count {
    font-weight: 600;
    color: var(--text);
}

/* ── Table ── */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

thead th {
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    vertical-align: top;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--accent-bg);
}

tbody tr.highlight td {
    background: #fef9c3;
}

/* ── Homepage Cards ── */

.hero {
    text-align: center;
    padding: 48px 0 40px;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1.2;
}

.hero h1 .cross {
    color: var(--cross);
}

.hero p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-top: 12px;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 40px;
}

.card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 24px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-icon {
    font-size: 1.75rem;
    margin-bottom: 12px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    border-radius: 10px;
}

.card h3 {
    font-size: 1.0625rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.card p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.card .card-count {
    margin-top: auto;
    padding-top: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
}

/* ── Province Selector (Farmacie) ── */

.province-selector {
    margin-bottom: 24px;
}

.province-selector label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.province-selector select {
    width: 100%;
    max-width: 400px;
    padding: 12px 16px;
    font-size: 1rem;
    font-family: inherit;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
}

.province-selector select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14,165,233,0.1);
}

.province-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ── Footer ── */

footer {
    border-top: 1px solid var(--border);
    padding: 20px 24px;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
    background: var(--bg-subtle);
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    color: var(--accent);
}

/* ── Empty / Hint States ── */

.hint {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.hint-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* ── Responsive ── */

@media (max-width: 768px) {
    header {
        height: auto;
    }

    .header-inner {
        padding: 10px 16px;
        flex-direction: column;
        gap: 8px;
        height: auto;
    }

    nav {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 4px;
    }

    nav a {
        font-size: 0.75rem;
        padding: 5px 8px;
    }

    main {
        padding: 20px 16px 32px;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }

    .card {
        padding: 16px;
    }

    .page-title h1 {
        font-size: 1.375rem;
    }

    table {
        font-size: 0.8125rem;
    }

    thead th, tbody td {
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }
}
