:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --text-color: #333;
    --light-text: #777;
    --border-color: #ddd;
}

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

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 40px 0;
    text-align: center;
}

header h1 {
    margin-bottom: 20px;
    font-size: 2.5rem;
}

.search-box {
    max-width: 600px;
    margin: 0 auto;
}

#search-input {
    width: 100%;
    padding: 15px 25px;
    border-radius: 30px;
    border: none;
    font-size: 1.1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    outline: none;
}

nav {
    background: white;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.category-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px 0;
}

.cat-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--light-text);
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.cat-btn.active {
    color: var(--secondary-color);
    border-bottom-color: var(--secondary-color);
}

.cat-btn:hover {
    color: var(--secondary-color);
}

main {
    padding: 40px 0;
    min-height: 60vh;
}

.drug-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.drug-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.drug-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.card-category {
    font-size: 0.8rem;
    color: var(--secondary-color);
    font-weight: bold;
    margin-bottom: 10px;
}

.card-name {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.card-manufacturer {
    font-size: 0.9rem;
    color: var(--light-text);
    margin-bottom: 20px;
    flex-grow: 1;
}

.detail-btn {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
}

.detail-btn:hover {
    background-color: #2980b9;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px;
    color: var(--light-text);
    font-size: 1.2rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.close {
    position: absolute;
    right: 25px;
    top: 20px;
    color: #aaa;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: var(--text-color);
}

.detail-header {
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.detail-category {
    background: var(--bg-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--secondary-color);
    font-weight: bold;
}

.detail-header h2 {
    margin-top: 15px;
    font-size: 2rem;
    color: var(--primary-color);
}

.manufacturer-large {
    color: var(--light-text);
    font-size: 1.1rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
}

.detail-item label {
    display: block;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.detail-item p {
    color: #555;
    background: #f9f9f9;
    padding: 12px;
    border-radius: 8px;
    line-height: 1.5;
}

.full-width {
    grid-column: 1 / -1;
}

footer {
    background: #f1f1f1;
    text-align: center;
    padding: 30px 0;
    margin-top: 50px;
    color: var(--light-text);
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
    .modal-content {
        margin: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
}
