@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&family=Outfit:wght@400;500;600;700&display=swap');

:root {
    --bg-base: #030712; /* 아주 깊은 진회색/블랙 */
    --bg-surface: rgba(17, 24, 39, 0.6);
    --bg-card: rgba(31, 41, 55, 0.4);
    
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(56, 189, 248, 0.4);
    
    --text-pure: #ffffff;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #475569;
    
    --accent-glow: 0 0 20px rgba(56, 189, 248, 0.4);
    --accent-glow-primary: 0 0 30px rgba(139, 92, 246, 0.5);
    
    --purple-primary: #8b5cf6;
    --purple-light: #a78bfa;
    --blue-primary: #3b82f6;
    --cyan-primary: #06b6d4;
    --accent-primary: #a78bfa;  /* serverCard, projectDetail 호환용 */
    
    --status-active: #10b981;
    --status-active-glow: 0 0 10px rgba(16, 185, 129, 0.5);
    --status-inactive: #ef4444;
    --status-inactive-glow: 0 0 10px rgba(239, 68, 68, 0.5);
    
    --font-heading: 'Outfit', sans-serif;
    --font-sans: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* { 
    margin: 0; padding: 0; box-sizing: border-box; 
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* 동적 배경 빛 효과 */
body::before, body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.5;
    animation: pulse 10s infinite alternate linear;
}

body::before {
    top: -10%; left: -10%;
    width: 50vw; height: 50vw;
    background: radial-gradient(circle, rgba(139,92,246,0.15) 0%, transparent 60%);
}

body::after {
    bottom: -10%; right: -10%;
    width: 60vw; height: 60vw;
    background: radial-gradient(circle, rgba(6,182,212,0.1) 0%, transparent 60%);
    animation-delay: -5s;
}

@keyframes pulse {
    0% { transform: scale(1) translate(0, 0); opacity: 0.4; }
    100% { transform: scale(1.1) translate(20px, -20px); opacity: 0.7; }
}

/* ─── Typography ─── */
h1, h2, h3, h4, h5 { font-family: var(--font-heading); font-weight: 600; letter-spacing: -0.02em; }
.text-mono { font-family: var(--font-mono); }
.text-gradient {
    background: linear-gradient(135deg, #a78bfa, #38bdf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ─── Layout ─── */
#app { display: flex; flex-direction: column; min-height: 100vh; }

.header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.25rem 4rem;
    background: rgba(3, 7, 18, 0.7);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    position: sticky; top: 0; z-index: 50;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.logo {
    display: flex; align-items: center; gap: 0.75rem;
    font-size: 1.7rem; font-weight: 700;
    font-family: var(--font-heading);
    letter-spacing: -0.04em;
}

.logo span:first-child { filter: drop-shadow(0 0 8px rgba(139,92,246,0.8)); }
.header-actions { display: flex; gap: 1rem; }

.main-content {
    padding: 3rem 4rem;
    flex: 1;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* ─── Components ─── */
.section-title {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-heading);
}

/* Glass Card - The core component */
.glass-card {
    background: linear-gradient(145deg, rgba(31, 41, 55, 0.4), rgba(17, 24, 39, 0.2));
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 1.75rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(125deg, rgba(255,255,255,0.05) 0%, transparent 40%);
    pointer-events: none;
}

.glass-card:hover {
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 10px 40px -10px rgba(139, 92, 246, 0.3);
    transform: translateY(-4px);
}

/* Grids */
.grid { display: grid; gap: 2rem; }
.grid-cols-3 { grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); }

/* Server Card Specifics */
.server-card { display: flex; flex-direction: column; gap: 1.25rem; }
.server-header { display: flex; justify-content: space-between; align-items: flex-start; }
.server-info { 
    font-family: var(--font-mono); font-size: 0.85rem; 
    color: var(--text-secondary); background: rgba(0,0,0,0.3);
    padding: 0.75rem; border-radius: 8px; border: 1px solid rgba(255,255,255,0.03);
}
.server-actions { display: flex; gap: 0.75rem; margin-top: auto; }

/* Dashboard Card (Project) */
.project-card { cursor: pointer; display: flex; flex-direction: column; height: 100%; }
.project-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem;
}
.project-domain { 
    font-weight: 600; font-size: 1.25rem; font-family: var(--font-heading);
    color: var(--text-pure); letter-spacing: -0.01em;
}
.project-path { 
    font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-secondary); 
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    background: rgba(0,0,0,0.2); padding: 0.5rem 0.75rem; border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.02);
}

.status-badge {
    padding: 0.25rem 0.875rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600; letter-spacing: 0.5px;
    display: flex; align-items: center; gap: 0.5rem;
    text-transform: uppercase;
}
.status-badge::before { content: ''; display: block; width: 6px; height: 6px; border-radius: 50%; }
.status-badge.active { background: rgba(16, 185, 129, 0.1); color: var(--status-active); border: 1px solid rgba(16, 185, 129, 0.2); }
.status-badge.active::before { background: var(--status-active); box-shadow: var(--status-active-glow); }
.status-badge.inactive { background: rgba(239, 68, 68, 0.1); color: var(--status-inactive); border: 1px solid rgba(239, 68, 68, 0.2); }
.status-badge.inactive::before { background: var(--status-inactive); box-shadow: var(--status-inactive-glow); }

/* Buttons */
.btn {
    padding: 0.6rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-family: var(--font-sans);
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
}

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; border-radius: 8px; }

.btn-primary {
    background: linear-gradient(135deg, var(--purple-primary), var(--blue-primary));
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
    border: 1px solid rgba(255,255,255,0.1);
}
.btn-primary:hover { 
    box-shadow: var(--accent-glow-primary); 
    transform: translateY(-2px); 
    background: linear-gradient(135deg, var(--purple-light), var(--cyan-primary));
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}
.btn-secondary:hover { 
    background: rgba(255, 255, 255, 0.1); 
    border-color: rgba(255, 255, 255, 0.2);
}

/* Modals */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    display: flex; justify-content: center; align-items: center;
    z-index: 100;
    opacity: 0; pointer-events: none; transition: all 0.4s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-content {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 20px;
    width: 90%; max-width: 900px; /* 상세 뷰를 위해 좀 더 넓게 */
    max-height: 85vh; overflow-y: auto;
    transform: translateY(40px) scale(0.95); transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.7), 0 0 30px rgba(139, 92, 246, 0.15);
}
.modal-overlay.active .modal-content { transform: translateY(0) scale(1); }

/* 스크롤바 커스텀 */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

.modal-header { 
    padding: 1.5rem 2rem; border-bottom: 1px solid var(--border-glass); 
    display: flex; justify-content: space-between; align-items: center; 
    position: sticky; top: 0; background: rgba(15, 23, 42, 0.95); z-index: 10;
}
.modal-body { padding: 2rem; }
.modal-footer { padding: 1.5rem 2rem; border-top: 1px solid var(--border-glass); display: flex; justify-content: flex-end; gap: 1rem; }

.close-btn { 
    background: rgba(255,255,255,0.05); 
    border: 1px solid rgba(255,255,255,0.1); 
    color: var(--text-muted); 
    font-size: 1.2rem; 
    line-height: 1; 
    cursor: pointer; 
    transition: all 0.2s; 
    width: 32px; height: 32px; 
    display: flex; align-items: center; justify-content: center; 
    border-radius: 8px;
}
.close-btn:hover { background: rgba(239, 68, 68, 0.2); color: #ff8080; border-color: rgba(239, 68, 68, 0.3); }

/* Forms */
.form-group { margin-bottom: 1.5rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-size: 0.875rem; color: var(--text-secondary); font-weight: 500; }
.form-input {
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s;
}
.form-input:focus { outline: none; border-color: var(--purple-primary); background: rgba(0, 0, 0, 0.5); box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2); }

/* Empty States */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-secondary); background: rgba(255,255,255,0.02); border-radius: 16px; border: 1px dashed rgba(255,255,255,0.1); }
.empty-icon { font-size: 3.5rem; margin-bottom: 1rem; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5)); }

/* Tags & Badges */
.tag-container { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.2);
    padding: 0.35rem 0.85rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Detail View Layout (Project Detail) */
.detail-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 3rem; }
@media (max-width: 1024px) { .detail-grid { grid-template-columns: 1fr; gap: 2rem; } }

.tech-icon { font-size: 1.5rem; margin-right: 0.75rem; background: rgba(255,255,255,0.05); padding: 0.5rem; border-radius: 10px; border: 1px solid rgba(255,255,255,0.05); }
.api-list { list-style: none; display: flex; flex-direction: column; gap: 1rem; }
.api-item { 
    background: linear-gradient(to right, rgba(255,255,255,0.03), rgba(0,0,0,0.2)); 
    padding: 1.25rem; border-radius: 12px; border-left: 3px solid var(--purple-primary); 
    border-top: 1px solid rgba(255,255,255,0.03); border-right: 1px solid rgba(255,255,255,0.03); border-bottom: 1px solid rgba(255,255,255,0.03);
}
.api-name { font-family: var(--font-heading); font-weight: 600; color: var(--text-pure); font-size: 1.1rem; }
.api-key { font-family: var(--font-mono); color: var(--cyan-primary); font-size: 0.9rem; margin-top: 0.5rem; display: inline-block; background: rgba(6,182,212,0.1); padding: 0.25rem 0.5rem; border-radius: 6px; }

/* Utility */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 1rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-8 { margin-bottom: 2rem; }

/* Toast */
#toast-container { position: fixed; bottom: 2rem; right: 2rem; z-index: 1000; display: flex; flex-direction: column; gap: 1rem; pointer-events: none; }
.toast {
    background: rgba(15, 23, 42, 0.9); backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px;
    padding: 1rem 1.5rem; color: white; display: flex; align-items: center; gap: 0.75rem;
    transform: translateX(120%) scale(0.9); transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    pointer-events: auto;
}
.toast.show { transform: translateX(0) scale(1); }
.toast.success { border-left: 4px solid var(--status-active); }
.toast.error { border-left: 4px solid var(--status-inactive); }

/* Animation Classes */
.animate-fade-in { animation: fadeIn 0.5s ease forwards; }
.animate-slide-up { animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { 
    from { opacity: 0; transform: translateY(20px); } 
    to { opacity: 1; transform: translateY(0); } 
}

/* Stagger animations for cards */
.grid > div:nth-child(1) { animation-delay: 0.1s; }
.grid > div:nth-child(2) { animation-delay: 0.2s; }
.grid > div:nth-child(3) { animation-delay: 0.3s; }
.grid > div:nth-child(4) { animation-delay: 0.4s; }
.grid > div:nth-child(5) { animation-delay: 0.5s; }
.grid > div:nth-child(6) { animation-delay: 0.6s; }
