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

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

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #141821;
    --bg-tertiary: #1a1f2e;
    --accent-primary: #00d9ff;
    --accent-secondary: #00ff88;
    --accent-danger: #ff3366;
    --accent-warning: #ffaa00;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #0a0e1a 0%, #141821 50%, #0f1419 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Animated Background Grid */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 217, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 217, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

/* Giriş Sayfası */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 450px;
}

.login-box {
    background: rgba(20, 24, 33, 0.95);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: 16px;
    padding: 48px;
    box-shadow: 
        var(--shadow-xl),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
}

.neon-title {
    font-family: 'Inter', sans-serif;
    font-size: 2em;
    font-weight: 800;
    text-align: center;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95em;
    margin-bottom: 32px;
    font-weight: 500;
    letter-spacing: 1px;
}

/* Form Elemanları */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(26, 31, 46, 0.8);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95em;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(26, 31, 46, 1);
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 0.85em;
}

/* Butonlar */
.btn-login,
.btn-primary,
.btn-secondary {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, #0099cc 100%);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 0.95em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(0, 217, 255, 0.3);
}

.btn-login:hover,
.btn-primary:hover,
.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 217, 255, 0.5);
}

.btn-login:active,
.btn-primary:active,
.btn-secondary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-secondary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-logout,
.btn-back {
    padding: 10px 20px;
    background: rgba(255, 51, 102, 0.15);
    border: 1px solid rgba(255, 51, 102, 0.3);
    border-radius: 8px;
    color: var(--accent-danger);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
    font-size: 0.9em;
}

.btn-logout:hover,
.btn-back:hover {
    background: rgba(255, 51, 102, 0.25);
    border-color: var(--accent-danger);
}

.error-message {
    background: rgba(255, 51, 102, 0.15);
    border: 1px solid rgba(255, 51, 102, 0.3);
    color: var(--accent-danger);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9em;
}

.login-info {
    margin-top: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85em;
}

/* Header */
.header {
    background: rgba(20, 24, 33, 0.95);
    border-bottom: 1px solid rgba(0, 217, 255, 0.15);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .neon-title {
    font-size: 1.4em;
    margin: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
    color: var(--text-secondary);
    font-size: 0.95em;
}

/* Main Container */
.main-container {
    padding: 40px;
    max-width: 1800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
}

.toolbar .btn-primary,
.toolbar .btn-secondary {
    width: auto;
    padding: 12px 24px;
    font-size: 0.9em;
}

/* Kabinler Grid */
.cabinets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 32px;
    margin-bottom: 40px;
}

.cabinet-large {
    background: linear-gradient(145deg, rgba(20, 24, 33, 0.95) 0%, rgba(26, 31, 46, 0.95) 100%);
    border: 3px solid #00ff88;
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
    position: relative;
}

.cabinet-large::after {
    content: '';
    position: absolute;
    left: 10%;
    right: 10%;
    bottom: -26px;
    height: 28px;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(0, 217, 255, 0.22) 0%, transparent 70%);
    filter: blur(6px);
    opacity: 0.6;
}

.cabinet-large:hover {
    transform: translateY(-8px);
    box-shadow: 
        var(--shadow-xl),
        0 0 40px rgba(0, 217, 255, 0.15);
    border-color: var(--accent-primary);
}

.cabinet-large:hover::before {
    opacity: 1;
}

.cabinet-header {
    margin-bottom: 20px;
    text-align: center;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0, 217, 255, 0.1);
}

.cabinet-header h3 {
    color: var(--text-primary);
    font-size: 1.3em;
    margin-bottom: 6px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.cabinet-location {
    color: var(--text-secondary);
    font-size: 0.85em;
    display: block;
    margin-top: 4px;
    font-weight: 500;
}

/* Kabin 3D Frame */
.cabinet-visual {
    width: 100%;
}

.cabinet-frame {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(180deg, #06080e 0%, #111521 100%);
    border: 1px solid rgba(10, 16, 26, 0.9);
    box-shadow:
        0 24px 45px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    padding: 0;
}

.cabinet-frame.detail-view {
    min-height: 960px;
}

.cabinet-top-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 52px;
    background: linear-gradient(180deg, #1b2233 0%, #121724 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    letter-spacing: 0.38em;
    text-transform: uppercase;
    z-index: 4;
}

.cabinet-top-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 12% 10%, rgba(0, 217, 255, 0.25), transparent 55%);
    opacity: 0.2;
    pointer-events: none;
}

.cabinet-brand {
    font-size: 0.72em;
    font-weight: 700;
    color: rgba(160, 196, 255, 0.85);
}

.cabinet-top-meta {
    font-size: 0.65em;
    font-family: 'JetBrains Mono', monospace;
    color: rgba(224, 232, 255, 0.45);
    letter-spacing: 0.16em;
}

.cabinet-inner {
    position: relative;
    padding: 28px 32px;
    background: linear-gradient(180deg, #0d111c 0%, #06080f 100%);
    overflow: hidden;
    perspective: 1400px;
}

.cabinet-frame.detail-view .cabinet-inner {
    padding-right: 40px;
    perspective: 1600px;
}

.cabinet-frame.detail-view .cabinet-top-panel {
    letter-spacing: 0.24em;
}

.cabinet-frame.detail-view .cabinet-brand {
    font-size: 0.78em;
}

.cabinet-frame.detail-view .cabinet-top-meta {
    letter-spacing: 0.12em;
}

.cabinet-door {
    pointer-events: none;
    position: absolute;
    inset: 18px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(43, 68, 112, 0.12) 40%, rgba(8, 11, 20, 0.88) 100%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.06),
        inset -12px 0 24px rgba(0, 0, 0, 0.7),
        inset 12px 0 24px rgba(0, 217, 255, 0.05);
    z-index: 1;
    transform-origin: left center;
    transform-style: preserve-3d;
    transition: transform 0.65s cubic-bezier(0.25, 0.21, 0.23, 0.98), opacity 0.65s ease;
}

.cabinet-door::before {
    content: '';
    position: absolute;
    inset: 14px;
    border-radius: 12px;
    background:
        radial-gradient(circle at 14% 14%, rgba(255, 255, 255, 0.18), transparent 42%),
        linear-gradient(180deg, rgba(20, 27, 41, 0.95), rgba(10, 13, 23, 0.95));
    opacity: 0.45;
}

.cabinet-door-reflection {
    position: absolute;
    top: 24px;
    bottom: 24px;
    left: 42px;
    width: 28px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.38) 0%, rgba(255, 255, 255, 0.05) 60%, transparent 100%);
    filter: blur(1px);
    opacity: 0.35;
}

.cabinet-handle {
    position: absolute;
    top: 50%;
    right: 28px;
    transform: translateY(-50%);
    width: 14px;
    height: 120px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(190, 200, 224, 0.85) 0%, rgba(92, 104, 134, 0.9) 100%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.2),
        0 12px 18px rgba(0, 0, 0, 0.35);
    opacity: 0.9;
}

.cabinet-rail {
    position: absolute;
    top: 40px;
    bottom: 40px;
    width: 8px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(32, 44, 68, 0.82) 0%, rgba(8, 11, 18, 0.95) 100%);
    z-index: 2;
    overflow: hidden;
}

.cabinet-rail::before {
    content: '';
    position: absolute;
    inset: 12px 0;
    background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0 3px, transparent 3px 8px);
    opacity: 0.15;
}

.cabinet-rail.rail-left {
    left: 28px;
}

.cabinet-rail.rail-right {
    right: 28px;
}

.cabinet-bottom-panel {
    height: 40px;
    background: linear-gradient(180deg, #141926 0%, #0b0d13 100%);
    border-top: 1px solid rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 4;
}

.cabinet-foot {
    display: inline-block;
    width: 46%;
    height: 7px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(40, 52, 72, 0.85) 0%, rgba(12, 16, 24, 0.85) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 3px 12px rgba(0, 0, 0, 0.45);
}

/* LED Power Indicators */
.cabinet-frame::before,
.cabinet-frame::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--accent-secondary);
    border-radius: 50%;
    box-shadow: 
        0 0 10px var(--accent-secondary),
        0 0 20px rgba(0, 255, 136, 0.5);
    animation: ledBlink 2s ease-in-out infinite;
}

.cabinet-frame::before {
    top: 12px;
    left: 12px;
}

.cabinet-frame::after {
    top: 12px;
    right: 12px;
}

@keyframes ledBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Kabin Detay */
.cabinet-detail-container {
    max-width: 1200px;
    margin: 0 auto;
}

.cabinet-info {
    background: linear-gradient(145deg, rgba(20, 24, 33, 0.95) 0%, rgba(26, 31, 46, 0.95) 100%);
    border: 1px solid rgba(0, 217, 255, 0.15);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
}

.cabinet-info h3 {
    color: var(--text-primary);
    font-size: 1.3em;
    margin-bottom: 16px;
    font-weight: 700;
}

.cabinet-info p {
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-size: 0.95em;
}

.cabinet-info strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Kabin Rack (Detay Sayfası) */
.cabinet-rack {
    background: linear-gradient(180deg, #0a0e1a 0%, #141821 100%);
    border: 2px solid rgba(0, 217, 255, 0.2);
    border-radius: 12px;
    padding: 24px;
    box-shadow:
        var(--shadow-lg),
        inset 0 2px 10px rgba(0, 0, 0, 0.5);
    position: relative;
}

.cabinet-rack::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
}

.u-slot-full {
    display: flex;
    align-items: center;
    background: linear-gradient(90deg, rgba(26, 31, 46, 0.6) 0%, rgba(20, 24, 33, 0.6) 100%);
    border: 1px solid rgba(0, 217, 255, 0.15);
    border-radius: 6px;
    min-height: 54px;
    transition: all 0.3s ease;
    margin-bottom: 6px;
    position: relative;
    overflow: hidden;
}

.u-slot-full::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent-primary);
    opacity: 0.3;
}

.u-slot-full:hover {
    border-color: var(--accent-primary);
    background: linear-gradient(90deg, rgba(26, 31, 46, 0.8) 0%, rgba(20, 24, 33, 0.8) 100%);
    box-shadow: 0 4px 12px rgba(0, 217, 255, 0.15);
}

.u-slot-full.occupied {
    background: linear-gradient(90deg, rgba(0, 255, 136, 0.08) 0%, rgba(0, 217, 255, 0.08) 100%);
    border-color: var(--accent-secondary);
}

.u-slot-full.occupied::before {
    background: var(--accent-secondary);
    opacity: 1;
}

.u-number {
    min-width: 70px;
    text-align: center;
    color: var(--accent-primary);
    font-weight: 700;
    font-size: 1em;
    border-right: 1px solid rgba(0, 217, 255, 0.15);
    padding: 14px;
    font-family: 'JetBrains Mono', monospace;
}

.u-content {
    flex: 1;
    padding: 12px 16px;
}

/* Device Info Card */
.device-info {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    padding: 8px;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.05) 0%, rgba(0, 217, 255, 0.05) 100%);
    border-radius: 6px;
}

.btn-add-device {
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px dashed rgba(0, 217, 255, 0.4);
    background: rgba(0, 217, 255, 0.12);
    color: var(--accent-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-add-device:hover {
    background: rgba(0, 217, 255, 0.2);
    border-style: solid;
}

.btn-remove {
    padding: 6px 12px;
    background: rgba(255, 51, 102, 0.18);
    border: 1px solid rgba(255, 51, 102, 0.3);
    border-radius: 6px;
    color: var(--accent-danger);
    cursor: pointer;
    font-size: 1em;
    font-weight: 700;
    transition: all 0.3s ease;
}

.btn-remove:hover {
    background: rgba(255, 51, 102, 0.3);
    box-shadow: 0 0 16px rgba(255, 51, 102, 0.35);
}

/* Device Continuation */
.device-continuation {
    text-align: center;
    padding: 8px;
    color: var(--text-secondary);
    font-size: 0.85em;
    font-family: 'JetBrains Mono', monospace;
}

/* Ethernet Connections */
.connections-section {
    background: linear-gradient(145deg, rgba(20, 24, 33, 0.95) 0%, rgba(26, 31, 46, 0.95) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    padding: 28px;
    margin-top: 40px;
    box-shadow: var(--shadow-md);
}

.connections-section h2 {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 24px;
    font-size: 1.5em;
    letter-spacing: -0.5px;
}

.connections-list {
    display: grid;
    gap: 16px;
}

.connection-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(26, 31, 46, 0.6);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    padding: 16px;
    transition: all 0.3s ease;
}

.connection-item:hover {
    border-color: #6366f1;
    background: rgba(26, 31, 46, 0.8);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.connection-source,
.connection-dest {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95em;
    min-width: 140px;
}

.connection-arrow {
    color: #6366f1;
    font-size: 1.3em;
}

.connection-port {
    color: var(--accent-primary);
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
}

.connection-desc {
    flex: 1;
    color: var(--text-secondary);
    font-size: 0.9em;
}

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

.modal-content {
    background: linear-gradient(145deg, rgba(20, 24, 33, 0.98) 0%, rgba(26, 31, 46, 0.98) 100%);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: 16px;
    margin: 5% auto;
    padding: 32px;
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 28px;
    font-size: 1.5em;
    letter-spacing: -0.5px;
}

.close {
    color: var(--accent-danger);
    float: right;
    font-size: 32px;
    font-weight: bold;
    line-height: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close:hover {
    color: #ff6688;
}

/* Responsive */
@media (max-width: 1200px) {
    .cabinets-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .main-container {
        padding: 20px;
    }

    .cabinets-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 20px;
    }
    
    .login-box {
        padding: 32px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        padding: 16px 24px;
    }
    
    .toolbar {
        flex-direction: column;
    }
    
    .cabinet-header h3 {
        font-size: 1.1em;
    }
}

@media (max-width: 480px) {
    .cabinets-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 24px;
    }
}

/* Rack Segments */
.rack-segment {
    display: flex;
    align-items: stretch;
    gap: 16px;
    padding: 14px 16px;
    margin-bottom: 12px;
    background: rgba(10, 14, 24, 0.72);
    border: 1px solid rgba(0, 217, 255, 0.14);
    border-radius: 14px;
    position: relative;
    transition: all 0.3s ease;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.02),
        0 12px 24px rgba(0, 0, 0, 0.35);
}

.rack-segment::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.06) 0%, rgba(0, 255, 136, 0.03) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.rack-segment.occupied::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 18px;
    bottom: 18px;
    width: 6px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(0, 255, 136, 0.7) 0%, rgba(0, 217, 255, 0.4) 100%);
    opacity: 0.85;
}

.rack-segment.type-firewall::before {
    background: linear-gradient(180deg, rgba(255, 198, 0, 0.7) 0%, rgba(255, 120, 0, 0.45) 100%);
}

.rack-segment.empty {
    background: rgba(7, 10, 18, 0.58);
    border-style: dashed;
    border-color: rgba(0, 217, 255, 0.2);
    box-shadow: inset 0 0 0 1px rgba(0, 217, 255, 0.05);
}

.rack-segment.empty:hover {
    border-color: var(--accent-primary);
    background: rgba(12, 16, 26, 0.75);
}

.rack-segment .u-range {
    width: 82px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75em;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.rack-segment.occupied .u-range {
    color: var(--accent-primary);
    font-weight: 700;
}

.rack-device {
    flex: 1;
    position: relative;
    background: linear-gradient(145deg, rgba(18, 24, 38, 0.94) 0%, rgba(30, 38, 58, 0.96) 100%);
    border-radius: 12px;
    border: 1px solid rgba(0, 217, 255, 0.16);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: hidden;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        inset 0 -1px 0 rgba(0, 0, 0, 0.55),
        0 16px 32px rgba(0, 0, 0, 0.45);
}

.rack-device::before {
    content: '';
    position: absolute;
    inset: 12px 14px;
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.55)),
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.85) 0 4px, rgba(0, 0, 0, 0.6) 4px 8px),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.07) 0 2px, transparent 2px 4px);
    opacity: 0.82;
}

.rack-device::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    opacity: 0.7;
}

.rack-device > * {
    position: relative;
    z-index: 2;
}

.rack-segment.size-1 .rack-device { min-height: 52px; padding: 14px 18px; }
.rack-segment.size-2 .rack-device { min-height: 96px; }
.rack-segment.size-3 .rack-device { min-height: 140px; }
.rack-segment.size-4 .rack-device { min-height: 184px; }

.rack-segment.type-server .rack-device {
    border-color: rgba(0, 255, 136, 0.28);
    box-shadow:
        inset 0 1px 0 rgba(0, 255, 136, 0.08),
        inset 0 -1px 0 rgba(0, 255, 136, 0.04),
        0 18px 36px rgba(0, 255, 136, 0.18);
}

.rack-segment.type-firewall .rack-device {
    border-color: rgba(255, 170, 0, 0.28);
    box-shadow:
        inset 0 1px 0 rgba(255, 170, 0, 0.08),
        inset 0 -1px 0 rgba(255, 170, 0, 0.04),
        0 18px 36px rgba(255, 170, 0, 0.18);
}

.device-header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.device-badge {
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(0, 217, 255, 0.12);
    border: 1px solid rgba(0, 217, 255, 0.35);
    color: var(--accent-primary);
    font-size: 0.7em;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 700;
}

.rack-segment.type-firewall .device-badge {
    background: rgba(255, 170, 0, 0.12);
    border-color: rgba(255, 170, 0, 0.35);
    color: var(--accent-warning);
}

.device-lights {
    display: flex;
    gap: 8px;
    align-items: center;
}

.status-led {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.35);
    position: relative;
    animation: ledPulse 2.6s ease-in-out infinite;
}

.status-led.disk {
    background: #00d9ff;
    box-shadow: 0 0 12px rgba(0, 217, 255, 0.6);
    animation-delay: 0.9s;
}

.status-led.network {
    background: #ffaa00;
    box-shadow: 0 0 12px rgba(255, 170, 0, 0.6);
    animation-delay: 1.6s;
}

.status-led.power {
    background: #00ff88;
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.6);
}

@keyframes ledPulse {
    0%, 100% {
        filter: brightness(1);
        opacity: 0.95;
    }
    50% {
        filter: brightness(1.35);
        opacity: 1;
    }
}

.device-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.device-name {
    font-size: 1em;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
    margin: 0;
    flex: initial;
}

.device-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.device-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.75em;
    font-family: 'JetBrains Mono', monospace;
}

.device-meta span::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.45;
}

.device-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75em;
    color: var(--text-secondary);
}

.device-footer .device-label {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
}

.device-footer .btn-remove {
    padding: 6px 14px;
    border-radius: 8px;
    background: rgba(255, 51, 102, 0.18);
    border: 1px solid rgba(255, 51, 102, 0.35);
    color: var(--accent-danger);
    font-size: 0.8em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.device-footer .btn-remove:hover {
    background: rgba(255, 51, 102, 0.3);
    box-shadow: 0 0 18px rgba(255, 51, 102, 0.35);
}

.empty-slot {
    flex: 1;
    min-height: 52px;
    border-radius: 12px;
    border: 1px dashed rgba(0, 217, 255, 0.18);
    background: linear-gradient(135deg, rgba(20, 28, 42, 0.55) 0%, rgba(12, 16, 26, 0.65) 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.empty-slot::before {
    content: '';
    position: absolute;
    top: 12px;
    bottom: 12px;
    left: 18px;
    right: 18px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
}

.empty-slot::after {
    content: '';
    position: absolute;
    inset: 18px 22px;
    background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 2px, transparent 2px 5px);
    opacity: 0.12;
    pointer-events: none;
}

.empty-slot-guide {
    position: absolute;
    top: 50%;
    left: 18px;
    right: 18px;
    height: 2px;
    background: rgba(0, 217, 255, 0.18);
    transform: translateY(-50%);
}

.empty-slot .btn-add-device {
    position: relative;
    z-index: 1;
    width: 85%;
    height: 38px;
    border-radius: 10px;
    border: 1px dashed rgba(0, 217, 255, 0.4);
    background: rgba(0, 217, 255, 0.12);
    color: var(--accent-primary);
    font-weight: 600;
    letter-spacing: 0.05em;
    font-size: 0.85em;
}

.empty-slot .btn-add-device:hover {
    background: rgba(0, 217, 255, 0.2);
    box-shadow: 0 0 18px rgba(0, 217, 255, 0.25);
}

.cabinet-stack {
    position: relative;
    z-index: 3;
    padding: 6px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 520px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) rgba(0, 0, 0, 0.3);
}

.cabinet-stack.interactive {
    max-height: 860px;
}

.cabinet-stack::-webkit-scrollbar {
    width: 8px;
}

.cabinet-stack::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.cabinet-stack::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 4px;
}

.device-meta span.device-chip {
    color: rgba(159, 240, 255, 0.85);
}

.device-meta span.device-asset {
    color: rgba(255, 255, 255, 0.65);
}

.cabinet-frame.detail-view .cabinet-door {
    transform: rotateY(-24deg);
    opacity: 0.45;
}

.cabinet-frame.detail-view .cabinet-stack {
    max-height: none;
    overflow-y: visible;
}
