:root {
    --primary-color: #004e92;
    --secondary-color: #000428;
    --accent-color: #00d2ff;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
}

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

/* Header & Hero */
header {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    color: white;
    padding: 80px 0;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    letter-spacing: -1px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 40px;
}

nav {
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

nav a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s;
}

nav a:hover, nav a.active {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* Search Box */
.search-container {
    max-width: 700px;
    margin: -40px auto 0;
    background: white;
    padding: 10px;
    border-radius: 50px;
    display: flex;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.search-container input {
    flex: 1;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    outline: none;
    border-radius: 50px;
}

.search-container button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0 30px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.search-container button:hover {
    background: var(--secondary-color);
}

/* Main Content */
main {
    padding: 60px 0;
    min-height: 400px;
}

.section-title {
    text-align: center;
    margin-bottom: 40px;
    font-size: 1.5rem;
    color: var(--text-muted);
}

/* Drug Cards */
.drug-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.drug-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.drug-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.08);
}

.drug-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
}

.card-category {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.card-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--secondary-color);
}

.card-manufacturer {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

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

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 40px;
    width: 90%;
    max-width: 800px;
    border-radius: 24px;
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.2);
}

.close {
    position: absolute;
    right: 30px;
    top: 25px;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-muted);
}

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

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

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.detail-item {
    margin-bottom: 15px;
}

.detail-item label {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.detail-item p {
    font-size: 1rem;
    color: var(--text-main);
}

.full-width {
    grid-column: span 2;
}

.highlight-box {
    background: #f1f5f9;
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
}

footer {
    background: white;
    padding: 40px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: 100px;
    color: var(--text-muted);
}

/* Empty State */
.no-results {
    text-align: center;
    padding: 100px 0;
    color: var(--text-muted);
}

.no-results i {
    font-size: 4rem;
    display: block;
    margin-bottom: 20px;
    opacity: 0.2;
}

@media (max-width: 768px) {
    .detail-grid { grid-template-columns: 1fr; }
    .full-width { grid-column: span 1; }
    header h1 { font-size: 2rem; }
}

/* Blog & Article Styles */
.article-list {
    display: flex;
    flex-direction: column;
    gap: 40px;
    margin-top: 40px;
}

.article-card {
    background: white;
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.article-card h2 {
    font-size: 1.8rem;
    color: var(--secondary-color);
    margin-bottom: 20px;
}

.article-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
}

.article-content {
    line-height: 1.8;
    color: var(--text-main);
    font-size: 1.05rem;
}

.article-content p {
    margin-bottom: 20px;
}

.article-content h3 {
    margin: 30px 0 15px;
    color: var(--primary-color);
}

/* Mandatory Page Footer Links */
.footer-links {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 0.85rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* Dark Mode Styles */
[data-theme='dark'] {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
}

[data-theme='dark'] header {
    background: linear-gradient(135deg, #020617 0%, #1e3a8a 100%);
}

[data-theme='dark'] .article-card, 
[data-theme='dark'] .test-container, 
[data-theme='dark'] .ai-container, 
[data-theme='dark'] .drug-card, 
[data-theme='dark'] .modal-content {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-main);
}

[data-theme='dark'] .search-container {
    background-color: #334155;
}

[data-theme='dark'] .search-container input {
    background-color: transparent;
    color: white;
}

[data-theme='dark'] .cat-btn {
    background-color: #334155 !important;
    color: #cbd5e1 !important;
    border-color: #475569 !important;
}

[data-theme='dark'] footer {
    background-color: #020617;
    border-color: #1e293b;
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s;
}

.theme-toggle:hover {
    transform: scale(1.1);
    background: rgba(255,255,255,0.3);
}
