/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
    /* Color Palette */
    --bg-dark: #070913;
    --bg-card: rgba(255, 255, 255, 0.02);
    --border-card: rgba(255, 255, 255, 0.07);
    --border-card-hover: rgba(255, 255, 255, 0.15);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Neon Glows */
    --cyan-glow: #00f2fe;
    --purple-glow: #a855f7;
    --emerald-glow: #10b981;
    --amber-glow: #f59e0b;
    --red-glow: #ef4444;
    
    /* Fonts */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Fira Code', monospace;
    
    /* Transitions */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.01);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   DYNAMIC BACKGROUND ORBS
   ========================================================================== */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.12;
    z-index: -1;
    pointer-events: none;
}

.orb-1 {
    top: -10%;
    left: 10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--cyan-glow) 0%, transparent 70%);
    animation: float-slow 20s infinite ease-in-out alternate;
}

.orb-2 {
    top: 30%;
    right: 5%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--purple-glow) 0%, transparent 70%);
    animation: float-slow 25s infinite ease-in-out alternate-reverse;
}

.orb-3 {
    bottom: -10%;
    left: 20%;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, var(--emerald-glow) 0%, transparent 70%);
    animation: float-slow 18s infinite ease-in-out alternate;
}

@keyframes float-slow {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(40px) scale(1.1); }
}

/* ==========================================================================
   LAYOUT CONTAINER
   ========================================================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 8rem 1.5rem; /* Large bottom padding for terminal drawer */
}

/* ==========================================================================
   GLASSMORPHISM BASE STYLE
   ========================================================================== */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    transition: var(--transition-smooth);
}

.glass:hover {
    border-color: var(--border-card-hover);
    background: rgba(255, 255, 255, 0.03);
}

/* ==========================================================================
   DASHBOARD HEADER
   ========================================================================== */
.dashboard-header {
    margin-bottom: 3.5rem;
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 1.5rem;
}

.title-area h1 {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    background: linear-gradient(135deg, #ffffff 30%, #a8a29e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

/* Pulsing Status Dot */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--emerald-glow);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--emerald-glow);
}

.pulsing {
    animation: pulse 2s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.5; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); opacity: 0.5; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.status-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--emerald-glow);
}

.server-node-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.node-tag {
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    color: var(--text-secondary);
}

.uptime-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.uptime-text span {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ==========================================================================
   METRICS PANELS
   ========================================================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-card:hover {
    box-shadow: 0 10px 30px -15px rgba(0, 242, 254, 0.05);
}

.metric-info h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.metric-number {
    font-size: 1.85rem;
    font-weight: 700;
}

.metric-visual {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Progress Circular Rings */
.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring__circle {
    stroke-dasharray: 150.79; /* 2 * PI * R (24) */
    stroke-dashoffset: 150.79;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    stroke-linecap: round;
}

/* Pulse Wave for Latency */
.pulse-wave {
    width: 60px;
    height: 60px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wave {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--cyan-glow);
    opacity: 0;
    animation: wave-expand 2s infinite linear;
}

.ring-1 { animation-delay: 0s; }
.ring-2 { animation-delay: 0.6s; }
.ring-3 { animation-delay: 1.2s; }

@keyframes wave-expand {
    0% { width: 8px; height: 8px; opacity: 0.8; }
    100% { width: 50px; height: 50px; opacity: 0; }
}

/* ==========================================================================
   SECTIONS & GRIDS
   ========================================================================== */
.dashboard-section {
    margin-bottom: 3.5rem;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.section-icon {
    color: var(--text-secondary);
}

.section-title h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.cards-grid.cols-3 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* ==========================================================================
   PROJECT CARDS
   ========================================================================== */
.project-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.75rem;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: transparent;
    transition: var(--transition-smooth);
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.4);
}

/* Theme accent highlights on top of cards on hover */
.project-card:hover::before {
    background: linear-gradient(90deg, var(--cyan-glow), var(--purple-glow));
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.icon-wrapper {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-icon {
    background: rgba(0, 242, 254, 0.08);
    color: var(--cyan-glow);
}

.casa-icon {
    background: rgba(168, 85, 247, 0.08);
    color: var(--purple-glow);
}

.portainer-icon {
    background: rgba(245, 158, 11, 0.08);
    color: var(--amber-glow);
}

.infra-icon {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
}

.badge-wrapper {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Badges */
.badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
}

.webapp-badge { background: rgba(0, 242, 254, 0.08); color: var(--cyan-glow); border: 1px solid rgba(0, 242, 254, 0.15); }
.dashboard-badge { background: rgba(168, 85, 247, 0.08); color: var(--purple-glow); border: 1px solid rgba(168, 85, 247, 0.15); }
.docker-badge { background: rgba(245, 158, 11, 0.08); color: var(--amber-glow); border: 1px solid rgba(245, 158, 11, 0.15); }
.api-badge { background: rgba(16, 185, 129, 0.08); color: var(--emerald-glow); border: 1px solid rgba(16, 185, 129, 0.15); }

/* Mini status indicators */
.status-indicator-mini {
    display: flex;
    align-items: center;
}
.status-dot-mini {
    width: 6px;
    height: 6px;
    background-color: var(--emerald-glow);
    border-radius: 50%;
    display: block;
}

/* Card Body */
.card-body h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

.project-url {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.project-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    flex-grow: 1;
}

/* Card Footer & Buttons */
.card-footer {
    margin-top: 1.75rem;
    display: flex;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    width: 100%;
}

.btn-primary {
    background: var(--text-primary);
    color: var(--bg-dark);
}

.btn-primary:hover {
    background: #ffffff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.arrow-icon {
    transition: transform 0.2s ease;
}

.btn-primary:hover .arrow-icon {
    transform: translateX(3px);
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   API LIST LAYOUT
   ========================================================================== */
.api-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.api-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
}

.api-left {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 75%;
}

.api-info h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.api-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Tech tag chips */
.tag {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.tag-dotnet { background: rgba(168, 85, 247, 0.06); color: #d8b4fe; border: 1px solid rgba(168, 85, 247, 0.12); }
.tag-postgres { background: rgba(0, 242, 254, 0.06); color: #7dd3fc; border: 1px solid rgba(0, 242, 254, 0.12); }
.tag-fastapi { background: rgba(16, 185, 129, 0.06); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.12); }
.tag-ml { background: rgba(245, 158, 11, 0.06); color: #fde047; border: 1px solid rgba(245, 158, 11, 0.12); }

.api-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Swagger Button */
.btn-swagger {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.08);
    color: var(--emerald-glow);
    border: 1px solid rgba(16, 185, 129, 0.2);
    text-decoration: none;
    transition: var(--transition-smooth);
}

.btn-swagger:hover {
    background: var(--emerald-glow);
    color: var(--bg-dark);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

/* ==========================================================================
   INFRASTRUCTURE & DETAILS
   ========================================================================== */
.infra-card {
    padding: 1.5rem;
}

.tag-hw { background: rgba(255, 255, 255, 0.04); color: var(--text-secondary); border: 1px solid rgba(255, 255, 255, 0.08); }
.tag-net { background: rgba(59, 130, 246, 0.08); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.15); }
.tag-runtime { background: rgba(16, 185, 129, 0.08); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.15); }

.infra-detail {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   INTERACTIVE TERMINAL DRAWER
   ========================================================================== */
.terminal-drawer {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(calc(100% - 44px)); /* Only show header by default */
    width: 100%;
    max-width: 900px;
    z-index: 1000;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: 0 -10px 40px -10px rgba(0,0,0,0.7);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.terminal-drawer.expanded {
    transform: translateX(-50%) translateY(0);
}

.terminal-header {
    height: 44px;
    padding: 0 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
}

.terminal-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.terminal-dot.red { background-color: var(--red-glow); }
.terminal-dot.yellow { background-color: var(--amber-glow); }
.terminal-dot.green { background-color: var(--emerald-glow); }

.terminal-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

.terminal-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.terminal-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.terminal-toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.terminal-drawer.expanded .terminal-toggle-btn {
    transform: rotate(180deg);
}

.terminal-body {
    height: 250px;
    padding: 1rem 1.25rem;
    background: rgba(3, 4, 9, 0.95);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    overflow-y: auto;
}

.terminal-history {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.terminal-line {
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Output Text Colors */
.text-green { color: var(--emerald-glow); }
.text-yellow { color: var(--amber-glow); }
.text-cyan { color: var(--cyan-glow); }
.text-purple { color: #d8b4fe; }
.text-red { color: var(--red-glow); }

.terminal-input-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.terminal-prompt {
    color: var(--cyan-glow);
    white-space: nowrap;
}

#terminal-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    flex-grow: 1;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.dashboard-footer {
    margin-top: 5rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 2rem;
}

.dashboard-footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==========================================================================
   RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================================================== */
@media (max-width: 900px) {
    .terminal-drawer {
        width: 100%;
        border-radius: 0;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1.5rem 1rem 6rem 1rem;
    }
    
    .header-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .server-node-info {
        align-items: flex-start;
    }
    
    .title-area h1 {
        font-size: 1.8rem;
    }
    
    .api-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
    }
    
    .api-left {
        max-width: 100%;
    }
    
    .api-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .terminal-hint {
        display: none;
    }
}
