/* Theme & Variables */
:root {
    --bg-base: #0D1B2A;
    --bg-glass: rgba(27, 38, 59, 0.7);
    --border-glass: rgba(116, 185, 255, 0.15);

    --primary: #0984E3;
    /* Ocean Blue */
    --primary-hover: #076CBF;
    --secondary: #74B9FF;
    /* Light Blue */

    --accent: #E17055;
    /* Orange/Red */
    --accent-glow: rgba(225, 112, 85, 0.3);

    --success: #00B894;
    /* Mint */
    --warning: #FDCB6E;
    /* Yellow */

    --text-main: #F1F2F6;
    --text-muted: #A4B0BE;

    --font-ui: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-md: 12px;
    --radius-lg: 16px;
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-ui);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow: hidden;
    position: relative;
}

/* Background Effects */
.bg-glow {
    position: absolute;
    top: -20%;
    right: -10%;
    width: 800px;
    height: 800px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(9, 132, 227, 0.15) 0%, transparent 60%);
    z-index: -1;
    filter: blur(60px);
}

/* Glassmorphism */
.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

/* Layout */
.app-container {
    width: 100%;
    max-width: 1300px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

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

.logo {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFF;
    box-shadow: 0 4px 15px rgba(9, 132, 227, 0.4);
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

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

.grid-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    flex: 1;
    overflow: hidden;
}

.pane {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-glass);
}

.pane:last-child {
    border-right: none;
}

.pane-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-glass);
    background: rgba(0, 0, 0, 0.2);
}

.pane-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    outline: none;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-primary {
    background: var(--primary);
    color: #FFF;
    box-shadow: 0 4px 12px rgba(9, 132, 227, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-glass);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-text {
    background: transparent;
    color: var(--text-muted);
}

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

/* Textarea Input */
.input-wrapper {
    flex: 1;
    display: flex;
    padding: 1.5rem;
    background: transparent;
}

textarea {
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1rem;
    color: #FFF;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(9, 132, 227, 0.2);
}

.actions {
    padding: 1.5rem;
    border-top: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Badges */
.badge {
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

.status-ok {
    background: rgba(0, 184, 148, 0.15);
    color: var(--success);
}

.status-err {
    background: rgba(225, 112, 85, 0.15);
    color: var(--accent);
}

/* Output Area */
.results-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.scroll-y::-webkit-scrollbar {
    width: 8px;
}

.scroll-y::-webkit-scrollbar-track {
    background: transparent;
}

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

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    opacity: 0.5;
}

.empty-icon {
    margin-bottom: 1rem;
    color: var(--secondary);
}

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

/* Typography */
.text-primary {
    color: var(--primary);
}

.text-accent {
    color: var(--accent);
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.hidden {
    display: none !important;
}

/* Dashboard Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-radius: var(--radius-md);
}

.card-title {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.card-val {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

/* Section Logic */
.section h3 {
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Visual Topology Map */
.visual-map {
    height: 180px;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
}

.map-track {
    position: absolute;
    height: 12px;
    border-radius: 6px;
    background: var(--primary);
    cursor: help;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.map-track:hover {
    filter: brightness(1.2);
    transform: scaleY(1.2);
}

.track-safe {
    background: var(--success);
}

.track-overlap {
    background: var(--accent);
}

.track-contained {
    background: var(--warning);
}

.map-axis {
    position: absolute;
    bottom: 0;
    left: 1.5rem;
    right: 1.5rem;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.map-tick {
    position: absolute;
    bottom: -20px;
    font-size: 0.7rem;
    color: var(--text-muted);
    transform: translateX(-50%);
    font-family: var(--font-mono);
}

.map-legend {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.safe {
    background: var(--success);
}

.dot.error {
    background: var(--accent);
}

.dot.warning {
    background: var(--warning);
}

/* Conflicts & Ranges Lists */
.conflict-list,
.range-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.item-row {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.item-row.err-border {
    border-left: 4px solid var(--accent);
}

.item-row.warn-border {
    border-left: 4px solid var(--warning);
}

.item-row.safe-border {
    border-left: 4px solid var(--success);
}

.row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cidr-tag {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 1.05rem;
}

.cidr-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.conflict-desc {
    font-size: 0.9rem;
    color: #FFF;
    background: rgba(225, 112, 85, 0.1);
    padding: 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(9, 132, 227, 0.9);
    color: #FFF;
    padding: 0.75rem 2rem;
    border-radius: 30px;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: 0 10px 25px rgba(9, 132, 227, 0.3);
    backdrop-filter: blur(10px);
    transition: opacity 0.3s;
    z-index: 100;
}

@media (max-width: 900px) {
    .grid-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        overflow: auto;
    }

    .pane {
        border-right: none;
        border-bottom: 1px solid var(--border-glass);
    }
}