/* Modern, Rada-Inspired CSS Design System */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

:root {
    --rada-blue: #0b2b61;
    --rada-blue-light: #164082;
    --rada-blue-dark: #071c3f;
    --rada-gold: #fdd700;
    --rada-gold-dark: #cca400;
    --rada-flag-blue: #0057b7;
    --rada-flag-yellow: #ffd700;
    --bg-light: #f5f6f8;
    --border-color: #d1d5db;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --success-bg: #d4edda;
    --success-text: #155724;
    --success-border: #c3e6cb;
    --warning-bg: #fff3cd;
    --warning-text: #856404;
    --warning-border: #ffeeba;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: 'Roboto', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-light);
    line-height: 1.6;
}

/* Header & Flag Line Styles */
.flag-line {
    height: 6px;
    background: linear-gradient(to right, var(--rada-flag-blue) 50%, var(--rada-flag-yellow) 50%);
    width: 100%;
}

header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo-block {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    color: inherit;
}

.coat-of-arms {
    width: 45px;
    height: 60px;
    background-image: url('https://zakonst.rada.gov.ua/images/design1/img/gerb.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.logo-text h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--rada-blue);
    letter-spacing: 0.5px;
    line-height: 1.1;
}

.logo-text h1 span {
    font-size: 11px;
    display: block;
    color: var(--text-muted);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

.logo-text .sub-title {
    font-size: 14px;
    color: var(--rada-blue-light);
    font-weight: 500;
    margin-top: 2px;
}

.gov-badge {
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--rada-blue);
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.gov-badge::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #28a745;
    border-radius: 50%;
}

/* Nav Bar Styles */
nav.main-nav {
    background-color: var(--rada-blue);
    color: #ffffff;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-menu {
    display: flex;
    list-style: none;
}

.nav-menu li a {
    display: block;
    padding: 12px 20px;
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: background-color 0.2s, color 0.2s;
    border-bottom: 3px solid transparent;
}

.nav-menu li a:hover,
.nav-menu li.active a {
    background-color: var(--rada-blue-light);
    border-bottom-color: var(--rada-gold);
    color: var(--rada-gold);
}

/* Main Content Styles */
main.content-area {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
    min-height: 60vh;
}

.search-title-section {
    text-align: center;
    margin-bottom: 35px;
}

.search-title-section h1 {
    font-size: 28px;
    color: var(--rada-blue-dark);
    margin-bottom: 12px;
    font-weight: 700;
    line-height: 1.25;
}

.search-title-section h2 {
    font-size: 18px;
    color: var(--text-muted);
    font-weight: 400;
    line-height: 1.5;
    max-width: 750px;
    margin: 0 auto;
}

.search-title-section p {
    color: var(--text-muted);
    font-size: 16px;
}

/* Interactive Search Box */
.search-wrapper {
    position: relative;
    margin-bottom: 30px;
    z-index: 100;
}

.search-input-group {
    display: flex;
    background: #ffffff;
    border: 2px solid var(--rada-blue);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.search-input-group:focus-within {
    box-shadow: 0 0 0 4px rgba(11, 43, 97, 0.15);
    border-color: var(--rada-blue-light);
}

.search-icon-btn {
    background: none;
    border: none;
    padding: 0 18px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-input {
    width: 100%;
    border: none;
    padding: 16px 20px 16px 0;
    font-size: 18px;
    color: var(--text-main);
    outline: none;
}

.search-input::placeholder {
    color: #a0aec0;
}

/* Interactive Dropdown Styles */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-top: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    max-height: 380px;
    overflow-y: auto;
    display: none;
    margin-top: 2px;
    z-index: 1000;
}

.dropdown-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f2f5;
    transition: background-color 0.15s;
    user-select: none;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover,
.dropdown-item.keyboard-active {
    background-color: #f3f7fd;
}

.dropdown-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}

.dropdown-checkbox::after {
    content: "✓";
    color: #ffffff;
    font-size: 12px;
    display: none;
    font-weight: bold;
}

.dropdown-item.selected .dropdown-checkbox {
    background-color: var(--rada-blue);
    border-color: var(--rada-blue);
}

.dropdown-item.selected .dropdown-checkbox::after {
    display: block;
}

.dropdown-text {
    flex-grow: 1;
}

.dropdown-inn {
    font-weight: 700;
    font-size: 14px;
    color: var(--rada-blue-dark);
}

.dropdown-brand {
    font-size: 13px;
    color: var(--text-main);
    margin-top: 2px;
    font-weight: 500;
}

.dropdown-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.dropdown-no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
}

/* Selected Items Section */
.selected-section {
    margin-top: 40px;
}

.selected-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--rada-blue-dark);
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.selected-count {
    background-color: var(--rada-blue);
    color: #ffffff;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 500;
}

.selected-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Premium Medical Cards */
.med-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--rada-blue);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    position: relative;
    animation: slideIn 0.3s ease-out;
}

.med-card.insulin {
    border-left-color: #8e44ad;
}

.med-card.medical_device {
    border-left-color: #16a085;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-remove-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s;
    line-height: 1;
}

.card-remove-btn:hover {
    color: #e74c3c;
}

.card-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff;
    background-color: var(--rada-blue-light);
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.card-tag.insulin {
    background-color: #8e44ad;
}

.card-tag.device {
    background-color: #16a085;
}

.card-inn {
    font-size: 20px;
    font-weight: 700;
    color: var(--rada-blue-dark);
    margin-bottom: 5px;
    padding-right: 25px;
}

.card-brand {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 15px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    border-top: 1px solid #f0f2f5;
    padding-top: 15px;
    margin-bottom: 15px;
}

.card-cell {
    font-size: 13px;
}

.cell-label {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.cell-val {
    font-weight: 500;
    color: var(--text-main);
    margin-top: 2px;
}

/* Pricing Footer Bar inside Cards */
.card-price-bar {
    background-color: #f8fafc;
    border-radius: 6px;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    border: 1px solid #edf2f7;
}

.price-item {
    font-size: 13px;
}

.price-label {
    color: var(--text-muted);
    font-size: 11px;
}

.price-val {
    font-weight: 700;
    color: var(--text-main);
}

.co-payment-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid transparent;
}

.co-payment-badge.free {
    background-color: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-border);
}

.co-payment-badge.charge {
    background-color: var(--warning-bg);
    color: var(--warning-text);
    border-color: var(--warning-border);
}

/* Empty State Styles */
.empty-state {
    text-align: center;
    padding: 10px 20px;
    background: #ffffff;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 40px;
    color: var(--border-color);
    margin-bottom: 10px;
    display: block;
}

/* Footer Section */
footer {
    background-color: #ffffff;
    border-top: 1px solid var(--border-color);
    padding: 30px 20px;
    margin-top: 60px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--rada-blue);
    text-decoration: none;
    font-weight: 500;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Responsive Grid Adjustments */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        text-align: center;
    }

    .nav-container {
        flex-direction: column;
    }

    .nav-menu {
        flex-direction: column;
        width: 100%;
        text-align: center;
    }

    .nav-menu li a {
        padding: 10px;
        border-bottom: none;
        border-left: 3px solid transparent;
    }

    .nav-menu li a:hover,
    .nav-menu li.active a {
        border-left-color: var(--rada-gold);
    }

    main.content-area {
        margin: 20px auto;
    }

    .search-title-section {
        margin-bottom: 20px;
    }

    .search-title-section h1 {
        font-size: 20px;
        margin-bottom: 8px;
        line-height: 1.3;
    }

    .search-title-section h2 {
        font-size: 14px;
        line-height: 1.45;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .card-price-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}