:root {
    --bg-color: #0f172a;
    --sidebar-bg: rgba(15, 23, 42, 0.6);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --font-main: 'Outfit', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    background: radial-gradient(circle at top right, #1e1b4b, #0f172a 40%, #020617);
}

/* Glassmorphism utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    padding: 2rem 0;
    display: flex;
    flex-direction: column;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 2rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 3rem;
}

.logo i {
    font-size: 2rem;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-links li {
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.nav-links li i {
    font-size: 1.25rem;
}

.nav-links li:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.nav-links li.active {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
    border-right: 3px solid var(--primary);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 3rem;
    display: flex;
    flex-direction: column;
}

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

h1 {
    font-size: 2rem;
    font-weight: 600;
}

h2 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.user-profile-wrapper {
    position: relative;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--glass-bg);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: var(--transition);
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 200px;
    background: #1e293b;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    padding: 0.5rem;
    z-index: 1000;
    display: none;
    animation: slideDown 0.2s ease forwards;
}

.user-dropdown.active {
    display: block;
}

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

.logout-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.8rem 1rem;
    background: transparent;
    border: none;
    color: #ff6b6b;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-main);
    transition: background 0.2s;
}

.logout-item:hover {
    background: rgba(255, 107, 107, 0.1);
}

/* Views */
.view {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.view.active {
    display: block;
}

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

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

.card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.15);
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.card-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.card-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.card-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.card-info p {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.text-right { text-align: right; }

/* Tables */
.dashboard-details, .table-container, .report-results {
    padding: 1.5rem;
}

.table-responsive {
    overflow-x: auto;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
}

.modern-table th, .modern-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.modern-table th {
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.modern-table tbody tr {
    transition: var(--transition);
}

.modern-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Forms */
.form-container {
    padding: 2rem;
    max-width: 600px;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

input, select {
    width: 100%;
    padding: 0.8rem 1rem;
    background: #020617; /* Fondo mucho más oscuro para máximo contraste */
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: #ffffff; /* Blanco puro para legibilidad */
    font-family: var(--font-main);
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

select {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
    padding-right: 2.5rem;
}

select option {
    background-color: #ffffff !important;
    color: #000000 !important;
}

input:focus, select:focus {
    background: #1e293b;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

input[readonly] {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn.primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn.success { background: var(--success); color: white; }
.btn.warning { background: var(--warning); color: white; }

/* Status Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    white-space: nowrap;
    display: inline-block;
}

.badge.disponible { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge.asignado { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge.en_uso { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }

/* Action Bar */
.action-bar {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at top right, #1e1b4b, #0f172a 40%, #020617);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.login-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.login-logo {
    max-height: 120px;
    object-fit: contain;
    margin-bottom: 2rem;
}

.login-card h2 {
    margin-bottom: 2rem;
}

.login-card form {
    width: 100%;
    text-align: left;
}

.hidden {
    display: none !important;
}

.full-width {
    width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--glass-border); padding: 1rem; flex-direction: row; justify-content: space-between; align-items: center; }
    .logo { margin-bottom: 0; padding: 0; }
    .nav-links { flex-direction: row; gap: 0; overflow-x: auto; }
    .nav-links li span { display: none; }
    .nav-links li { padding: 0.5rem 1rem; }
    .main-content { padding: 1.5rem; }
}

/* El modal de confirmación siempre encima de cualquier otro modal */
#confirm-modal {
    z-index: 2000;
}

/* In-Use Graphical Grid */
.in-use-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.in-use-card {
    position: relative;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    transition: var(--transition);
    border-left: 4px solid var(--success);
}

.in-use-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.3);
    border-color: var(--primary);
    background: rgba(30, 41, 59, 0.9);
}

.in-use-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.in-use-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

.in-use-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 2px;
}

.in-use-info span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.in-use-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.in-use-tech {
    display: flex;
    align-items: center;
    gap: 10px;
}

.in-use-serial-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
}

.in-use-serial-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.in-use-serial-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
}

.in-use-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
    font-size: 0.85rem;
    color: var(--text-muted);
}
