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

:root {
    --primary: hsl(262, 83%, 58%);
    --primary-dark: hsl(262, 83%, 48%);
    --secondary: hsl(199, 89%, 48%);
    --success: hsl(142, 76%, 36%);
    --warning: hsl(38, 92%, 50%);
    --danger: hsl(0, 84%, 60%);
    --bg-dark: hsl(220, 26%, 14%);
    --bg-darker: hsl(220, 26%, 10%);
    --bg-card: hsl(220, 26%, 16%);
    --text-primary: hsl(0, 0%, 98%);
    --text-secondary: hsl(220, 10%, 65%);
    --border-color: hsl(220, 26%, 22%);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 15px 40px rgba(0, 0, 0, 0.4);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-darker);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Dashboard Layout */
.dashboard-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    background: var(--bg-dark);
    border-right: 1px solid var(--border-color);
    padding: 2rem 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.logo {
    padding: 0 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

.logo h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.nav-item .icon {
    font-size: 1.25rem;
}

/* Main Content */
.main-content {
    background: var(--bg-darker);
    padding: 2rem 3rem;
    overflow-y: auto;
}

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

.header h1 {
    font-size: 2rem;
    font-weight: 700;
}

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

.btn-refresh {
    padding: 0.625rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-refresh:hover {
    background: var(--bg-dark);
    transform: translateY(-2px);
}

.api-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--bg-card);
    border-radius: 8px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-indicator.healthy {
    background: var(--success);
}

.status-indicator.unhealthy {
    background: var(--danger);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-dark));
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.stat-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 12px;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
}

/* Servers Grid */
.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.server-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.server-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.server-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.server-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.server-ip {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.server-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.server-badge.healthy {
    background: hsla(142, 76%, 36%, 0.2);
    color: var(--success);
}

.server-badge.unhealthy {
    background: hsla(0, 84%, 60%, 0.2);
    color: var(--danger);
}

.server-badge.expiring {
    background: hsla(38, 92%, 50%, 0.2);
    color: var(--warning);
}

.server-storage {
    margin: 1.5rem 0;
}

.storage-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.storage-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-darker);
    border-radius: 4px;
    overflow: hidden;
}

.storage-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.server-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.info-item {
    font-size: 0.875rem;
}

.info-label {
    color: var(--text-secondary);
}

.info-value {
    font-weight: 600;
}

/* Media Grid */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.media-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.media-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.media-thumbnail {
    width: 100%;
    height: 160px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.media-body {
    padding: 1.25rem;
}

.media-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.media-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.4);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-dark);
    transform: translateY(-2px);
}

/* Search and Filter */
.search-box {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.search-box input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
}

.search-box button {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-box button:hover {
    transform: translateY(-2px);
}

select {
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
}

/* Upload Container */
.upload-container {
    max-width: 600px;
    margin: 0 auto;
}

.upload-box {
    background: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s ease;
}

.upload-box:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-form {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 2rem;
    margin-top: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
}

.upload-progress {
    margin: 1.5rem 0;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--bg-darker);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 6px;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    font-weight: 600;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-dark);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-hover);
    animation: modalSlideIn 0.3s ease;
}

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

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

.modal-header h3 {
    font-size: 1.5rem;
}

.modal-close {
    font-size: 2rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.migration-warning {
    padding: 1rem;
    background: hsla(38, 92%, 50%, 0.1);
    border: 1px solid var(--warning);
    border-radius: 8px;
    color: var(--warning);
    font-size: 0.875rem;
}

/* Migration List */
.migration-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.migration-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

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

.migration-route {
    font-size: 1.125rem;
    font-weight: 600;
}

.migration-status {
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.migration-status.running {
    background: hsla(199, 89%, 48%, 0.2);
    color: var(--secondary);
}

.migration-status.completed {
    background: hsla(142, 76%, 36%, 0.2);
    color: var(--success);
}

.migration-status.failed {
    background: hsla(0, 84%, 60%, 0.2);
    color: var(--danger);
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-container {
        grid-template-columns: 220px 1fr;
    }
    
    .main-content {
        padding: 1.5rem 2rem;
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: fixed;
        left: -280px;
        transition: left 0.3s ease;
        z-index: 100;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .servers-grid,
    .media-grid {
        grid-template-columns: 1fr;
    }
}
