/* ===== VARIABLES ===== */
:root {
    --bg-dark: #0f0f0f;
    --bg-card: #1a1a1a;
    --bg-input: #2a2a2a;
    --primary: #6d28d9;
    --primary-hover: #5b21b6;
    --text-light: #f3f4f6;
    --text-muted: #9ca3af;
    --border: #374151;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #059669;
}

/* ===== RESET Y GLOBALES ===== */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* ===== LOGIN / REGISTER ===== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, rgba(109, 40, 217, 0.15) 0%, transparent 50%);
    padding: 1rem;
}

.auth-card {
    background-color: var(--bg-card);
    border-radius: 1rem;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
}

.auth-card h1 {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #a78bfa, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-card h2 {
    font-size: 1.25rem;
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.auth-form .form-group {
    margin-bottom: 1.2rem;
}

.auth-form label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    padding-left: 0.2rem;
}

.auth-form input {
    width: 100%;
    padding: 0.7rem 1rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-light);
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.2);
}

.auth-form button {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 1rem;
}

.auth-form button:hover {
    background-color: var(--primary-hover);
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.auth-footer a {
    color: var(--primary);
    font-weight: 500;
}

/* ===== ALERTAS ===== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}
.alert-error {
    background-color: rgba(220, 38, 38, 0.1);
    border: 1px solid var(--danger);
    color: #fca5a5;
}
.alert-info {
    background-color: rgba(5, 150, 105, 0.1);
    border: 1px solid var(--success);
    color: #a7f3d0;
}
.alert-success {
    background-color: rgba(5, 150, 105, 0.1);
    border: 1px solid var(--success);
    color: #a7f3d0;
}

/* ===== NAVBAR ===== */
.navbar {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.navbar-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #a78bfa, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.navbar-user {
    color: var(--text-light);
    font-size: 0.875rem;
}

.navbar-link {
    color: var(--text-muted);
    transition: color 0.2s;
    text-decoration: none;
    font-size: 0.9rem;
}
.navbar-link:hover {
    color: var(--primary);
}

.navbar-icon-btn {
    background-color: transparent;
    color: var(--text-light);
    font-size: 1.8rem;
    line-height: 1;
    padding: 0.2rem 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s, color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.navbar-icon-btn:hover {
    background-color: var(--primary);
    color: white;
}

.navbar-logout {
    background-color: var(--danger);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.2s;
    text-decoration: none;
}
.navbar-logout:hover {
    background-color: var(--danger-hover);
    color: white;
}

/* ===== DASHBOARD ===== */
.dashboard-container {
    max-width: 1280px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    width: 100%;
    flex: 1;
}

.dashboard-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-light);
}

/* Grid de servidores: 3 columnas fijas en escritorio */
.servers-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .servers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.server-card {
    background-color: var(--bg-card);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border);
    position: relative;
    min-height: 200px;
    background-size: cover;
    background-position: center;
}

.server-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

.server-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0.3));
    opacity: 0.8;
}

.server-card-content {
    position: relative;
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.server-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.server-stats {
    font-size: 0.875rem;
    color: rgba(255,255,255,0.8);
    margin-bottom: 1rem;
    flex-grow: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.server-stats span {
    color: white;
    font-weight: 600;
}

.server-button {
    display: inline-block;
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    text-align: center;
    transition: background-color 0.2s;
    text-decoration: none;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
}
.server-button:hover {
    background-color: var(--primary-hover);
    color: white;
}

/* ===== PERFIL ===== */
.profile-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    width: 100%;
    flex: 1;
}

.profile-card {
    background-color: var(--bg-card);
    border-radius: 1rem;
    padding: 2rem;
    border: 1px solid var(--border);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

.profile-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-light);
}

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

.profile-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.profile-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-light);
    font-size: 1rem;
}

.profile-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.2);
}

/* Filas de dos columnas */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row .form-group {
    margin-bottom: 0;
}

/* Botón de guardar */
.profile-submit-btn {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 1rem;
    width: 100%;
    margin-top: 1rem;
}
.profile-submit-btn:hover {
    background-color: var(--primary-hover);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .auth-card {
        padding: 1.5rem;
    }
    .navbar-container {
        flex-direction: column;
        align-items: stretch;
    }
    .navbar-menu {
        justify-content: center;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .profile-container {
        max-width: 100%;
    }
}

/* ===== SERVIDOR (PÁGINA INDIVIDUAL) ===== */
.server-container {
    display: flex;
    min-height: calc(100vh - 60px);
}

.server-sidebar {
    width: 250px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 1rem 0;
    overflow-y: auto;
    flex-shrink: 0;
}

.server-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.server-sidebar li {
    margin-bottom: 0.25rem;
}

.server-sidebar a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.server-sidebar a i {
    width: 1.25rem;
    font-size: 1.1rem;
}

.server-sidebar a:hover {
    background-color: rgba(109, 40, 217, 0.1);
    color: var(--text-light);
}

.server-sidebar a.active {
    background-color: var(--primary);
    color: white;
}

.server-main {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background-color: var(--bg-dark);
}

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

.server-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-light);
}

.power-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.875rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-warning {
    background-color: #f59e0b;
    color: white;
}
.btn-warning:hover {
    background-color: #d97706;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}
.btn-danger:hover {
    background-color: var(--danger-hover);
}

.status-badge {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.875rem;
}
.status-badge.online {
    background-color: rgba(5, 150, 105, 0.2);
    color: #10b981;
}
.status-badge.offline {
    background-color: rgba(220, 38, 38, 0.2);
    color: #ef4444;
}

/* Grid de estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-light);
}

/* Consola */
.console-container {
    background-color: #1e1e1e;
    border-radius: 0.5rem;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    height: 400px;
    overflow-y: auto;
    color: #f0f0f0;
    font-size: 0.875rem;
    border: 1px solid var(--border);
}

.console-input {
    display: flex;
    margin-top: 1rem;
    gap: 0.5rem;
}

.console-input input {
    flex: 1;
    padding: 0.75rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    color: var(--text-light);
    font-size: 0.95rem;
}

.console-input input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.2);
}

/* Secciones */
.section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .server-container {
        flex-direction: column;
    }
    .server-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 0.5rem;
    }
    .server-sidebar ul {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    .server-sidebar a {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    .server-sidebar a i {
        font-size: 1rem;
    }
    .server-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .power-actions {
        width: 100%;
        justify-content: space-between;
    }
    .btn {
        flex: 1;
        text-align: center;
    }
}

/* Efecto de pulsar en botones */
.pulse-effect {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

/* Estilos para listas de archivos y tablas */
.file-list {
    list-style: none;
    padding: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
}
.file-list li {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.file-list li:last-child {
    border-bottom: none;
}
.file-list i {
    width: 1.5rem;
    color: var(--text-muted);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
}
.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    background-color: rgba(255,255,255,0.05);
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}
.data-table tr:last-child td {
    border-bottom: none;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Indicador de conexión WebSocket (opcional) */
.ws-status {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.5rem;
}
.ws-connected {
    background-color: #10b981;
    box-shadow: 0 0 5px #10b981;
}
.ws-disconnected {
    background-color: #ef4444;
}