/* ==========================================================================
   Design System & Variable Definitions
   ========================================================================== */
:root {
    /* Color Palette */
    --bg-main: #07080d;
    --bg-glass: rgba(16, 20, 36, 0.45);
    --bg-glass-hover: rgba(22, 28, 48, 0.6);
    --bg-glass-active: rgba(26, 34, 58, 0.85);
    --bg-modal: rgba(10, 12, 22, 0.95);
    
    --border-glass: rgba(255, 255, 255, 0.07);
    --border-glass-hover: rgba(0, 242, 254, 0.4);
    
    --neon-cyan: #00f2fe;
    --neon-blue: #4facfe;
    --neon-purple: #b16efb;
    --neon-green: #00ff87;
    --neon-red: #ff3366;
    
    --text-main: #f5f6fa;
    --text-muted: #8e9bb0;
    --text-dark: #121620;
    
    /* Typography */
    --font-outfit: 'Outfit', 'Noto Sans KR', sans-serif;
    
    /* Transitions & Shadows */
    --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: all 0.2s ease;
    --glow-cyan: 0 0 20px rgba(0, 242, 254, 0.25);
    --glow-purple: 0 0 20px rgba(177, 110, 251, 0.25);
    --glow-green: 0 0 20px rgba(0, 255, 135, 0.25);
    
    /* Layout Sizes */
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --max-width: 1440px;
}

/* ==========================================================================
   Base Styles & Visual Decorations
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

/* Glassmorphic Background Layer */
.glass-bg-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -2;
    background: radial-gradient(circle at 50% 50%, #101524 0%, #06080d 100%);
}

/* Animated Glowing Orbs */
.glow-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.45;
}

.glow-orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--neon-cyan) 0%, rgba(79, 172, 254, 0.2) 60%, transparent 100%);
    top: -200px;
    left: -200px;
    animation: orb-float-left 25s infinite alternate ease-in-out;
}

.glow-orb-2 {
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, var(--neon-purple) 0%, rgba(177, 110, 251, 0.15) 60%, transparent 100%);
    bottom: -300px;
    right: -200px;
    animation: orb-float-right 30s infinite alternate ease-in-out;
}

@keyframes orb-float-left {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(150px, 100px) scale(1.15); }
}

@keyframes orb-float-right {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-100px, -150px) scale(0.9); }
}

/* Glass Card Utility class */
.glass-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    transition: var(--transition-smooth);
}

/* ==========================================================================
   Layout Containers
   ========================================================================== */
.app-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* ==========================================================================
   Header Section
   ========================================================================== */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    background: rgba(16, 20, 36, 0.3);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-wrapper {
    position: relative;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: rgba(0, 242, 254, 0.05);
    border: 1px solid rgba(0, 242, 254, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--glow-cyan);
}

.raccoon-logo-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
}

.pulse-ring {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    border: 2px solid var(--neon-cyan);
    animation: ring-pulse 2.5s infinite ease-out;
}

@keyframes ring-pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.3); opacity: 0; }
}

.title-wrapper h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-main) 30%, #a2a8b9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.datetime-widget {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: monospace;
}

#widget-time {
    font-size: 20px;
    font-weight: 600;
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.4);
    letter-spacing: 0.5px;
}

#widget-date {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-outfit);
}

/* Settings Toggle Button */
.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.icon-btn:hover {
    background: rgba(0, 242, 254, 0.15);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: var(--glow-cyan);
    transform: rotate(45deg);
}

/* ==========================================================================
   Server Stats Section
   ========================================================================== */
.server-stats-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 24px;
}

.stat-icon {
    font-size: 32px;
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
}

.status-online {
    color: var(--neon-green);
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-online::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--neon-green);
    box-shadow: 0 0 10px var(--neon-green);
    animation: pulse-dot 1.5s infinite alternate;
}

@keyframes pulse-dot {
    0% { transform: scale(0.9); opacity: 0.6; }
    100% { transform: scale(1.2); opacity: 1; }
}

/* ==========================================================================
   Toolbar Section (Search & Category Filters)
   ========================================================================== */
.toolbar-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.search-container {
    position: relative;
    flex: 1;
    max-width: 500px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 52px;
    border: 1px solid var(--border-glass);
}

.search-icon {
    color: var(--text-muted);
    margin-right: 12px;
    transition: var(--transition-fast);
}

.search-container input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-family: var(--font-outfit);
    font-size: 15px;
    width: 100%;
    height: 100%;
}

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

.search-hint {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    color: var(--text-muted);
    font-family: monospace;
    pointer-events: none;
}

.search-container:focus-within {
    border-color: var(--neon-cyan);
    box-shadow: var(--glow-cyan);
}

.search-container:focus-within .search-icon {
    color: var(--neon-cyan);
}

/* Category Filters */
.category-filters {
    display: flex;
    gap: 8px;
    background: rgba(16, 20, 36, 0.35);
    border: 1px solid var(--border-glass);
    padding: 6px;
    border-radius: var(--radius-md);
}

.filter-tab {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-muted);
    font-family: var(--font-outfit);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.filter-tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

.filter-tab.active {
    color: var(--text-dark);
    background: linear-gradient(135deg, var(--neon-cyan) 0%, var(--neon-blue) 100%);
    font-weight: 600;
    box-shadow: var(--glow-cyan);
}

/* ==========================================================================
   Main Grid & Service Cards
   ========================================================================== */
.grid-container {
    flex: 1;
}

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

/* Individual Card */
.service-card {
    display: flex;
    flex-direction: column;
    height: 180px;
    padding: 24px;
    text-decoration: none;
    color: var(--text-main);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 242, 254, 0.03) 0%, rgba(177, 110, 251, 0.03) 100%);
    opacity: 0;
    transition: var(--transition-smooth);
}

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    z-index: 1;
}

.card-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.card-icon-wrapper svg {
    width: 22px;
    height: 22px;
    stroke: var(--text-main);
    stroke-width: 2;
    fill: none;
    transition: var(--transition-smooth);
}

.card-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.1);
    transition: var(--transition-fast);
}

.card-status-dot.online {
    background-color: var(--neon-green);
    box-shadow: 0 0 8px var(--neon-green);
}

.card-status-dot.offline {
    background-color: var(--neon-red);
    box-shadow: 0 0 8px var(--neon-red);
}

/* Card Body */
.card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 1;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.2px;
    transition: var(--transition-fast);
}

.card-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
    height: 38px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Hover State */
.service-card:hover {
    transform: translateY(-6px);
    border-color: var(--border-glass-hover);
    box-shadow: var(--glow-cyan);
}

.service-card:hover::before {
    opacity: 1;
}

.service-card:hover .card-icon-wrapper {
    background: rgba(0, 242, 254, 0.1);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}

.service-card:hover .card-icon-wrapper svg {
    stroke: var(--neon-cyan);
    transform: scale(1.05);
}

.service-card:hover .card-title {
    color: var(--neon-cyan);
}

/* ==========================================================================
   Footer Section
   ========================================================================== */
.main-footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--border-glass);
}

/* ==========================================================================
   Modal Dialogs & Form Styling
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: opacity 0.3s ease;
}

.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    background: var(--bg-modal);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open .modal-container {
    transform: translateY(0);
}

.form-modal-container {
    max-width: 480px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-glass);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-main);
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: var(--transition-fast);
}

.close-btn:hover {
    color: var(--neon-red);
}

.modal-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
}

.modal-divider {
    border: none;
    height: 1px;
    background: var(--border-glass);
    margin: 24px 0;
}

/* Form Layouts */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.form-group input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: var(--font-outfit);
    font-size: 14px;
    padding: 12px 14px;
    outline: none;
    transition: var(--transition-fast);
}

.form-group select {
    background-color: #161c30; /* Solid dark background for select */
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: var(--font-outfit);
    font-size: 14px;
    padding: 12px 14px;
    outline: none;
    transition: var(--transition-fast);
}

.form-group input:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.15);
    background: rgba(255, 255, 255, 0.05);
}

.form-group select:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.15);
    background-color: #1a223c;
}

.form-group select option {
    background-color: #161c30 !important;
    color: #f5f6fa !important;
}

.form-help {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.3;
}

.input-with-btn {
    display: flex;
    gap: 12px;
}

.input-with-btn input {
    flex: 1;
}

/* Buttons */
.btn {
    font-family: var(--font-outfit);
    font-size: 14px;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--neon-cyan) 0%, var(--neon-blue) 100%);
    color: var(--text-dark);
    box-shadow: var(--glow-cyan);
}

.btn-primary:hover {
    opacity: 0.9;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-success {
    background: linear-gradient(135deg, var(--neon-green) 0%, #00d27a 100%);
    color: var(--text-dark);
    box-shadow: var(--glow-green);
}

.btn-success:hover {
    opacity: 0.9;
    box-shadow: 0 0 15px rgba(0, 255, 135, 0.4);
}

.btn-danger {
    background: rgba(255, 51, 102, 0.1);
    border: 1px solid rgba(255, 51, 102, 0.3);
    color: var(--neon-red);
}

.btn-danger:hover {
    background: var(--neon-red);
    color: var(--text-main);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 28px;
    border-top: 1px solid var(--border-glass);
}

/* Network Config Layout */
.mgmt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.services-list-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Service Edit row */
.mgmt-service-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    padding: 12px 18px;
    border-radius: var(--radius-md);
}

.mgmt-item-left {
    display: flex;
    flex-direction: column;
}

.mgmt-item-name {
    font-weight: 600;
    font-size: 14.5px;
}

.mgmt-item-details {
    font-size: 11.5px;
    color: var(--text-muted);
}

.mgmt-item-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon-edit:hover {
    color: var(--neon-cyan);
    border-color: var(--neon-cyan);
    background: rgba(0, 242, 254, 0.05);
}

.btn-icon-delete:hover {
    color: var(--neon-red);
    border-color: var(--neon-red);
    background: rgba(255, 51, 102, 0.05);
}

/* Scrollbars styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   Notification Toasts
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 200;
}

.toast {
    background: rgba(10, 14, 25, 0.9);
    border: 1px solid var(--border-glass);
    border-left: 4px solid var(--neon-cyan);
    padding: 14px 22px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    min-width: 250px;
    backdrop-filter: blur(10px);
    transform: translateY(20px);
    opacity: 0;
    animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toast-in {
    100% { transform: translateY(0); opacity: 1; }
}

.toast.toast-error {
    border-left-color: var(--neon-red);
}

.toast.toast-success {
    border-left-color: var(--neon-green);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1024px) {
    .app-container {
        padding: 24px 16px;
    }
    
    .server-stats-section {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
        padding: 20px;
    }
    
    .header-right {
        justify-content: space-between;
    }
    
    .datetime-widget {
        align-items: flex-start;
    }
    
    .server-stats-section {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .toolbar-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-container {
        max-width: 100%;
    }
    
    .category-filters {
        overflow-x: auto;
        white-space: nowrap;
        justify-content: flex-start;
    }
    
    .filter-tab {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .services-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }
    
    .modal-container {
        max-height: 95vh;
    }
}

/* ==========================================================================
   Drag and Drop Feedback Styles
   ========================================================================== */
.service-card.dragging {
    opacity: 0.45;
    border-color: var(--neon-blue);
    box-shadow: none;
    transform: scale(0.98);
}

.service-card.drag-over {
    border: 2px dashed var(--neon-cyan) !important;
    background: rgba(0, 242, 254, 0.08) !important;
    transform: scale(1.03) translateY(-4px);
    box-shadow: var(--glow-cyan);
}

