:root {
    --bg-dark: #0f1115;
    --card-bg: rgba(25, 28, 35, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-muted: #a0aabf;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --danger-color: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Glassmorphism utility */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

/* Login Container */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    text-align: center;
}

.login-card h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(to right, #fff, #a0aabf);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 14px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.error-msg {
    color: var(--danger-color);
    font-size: 13px;
    margin-top: 10px;
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar {
    width: 100%;
    border-bottom: 1px solid var(--border-color);
    padding: 15px 24px;
    display: flex;
    flex-direction: row;
    align-items: center;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
}

.sidebar-header {
    margin-right: 40px;
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    flex: 1;
    align-items: center;
}

.nav-links li {
    margin-bottom: 0;
}

.nav-links a {
    display: block;
    padding: 10px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-links a:hover, .nav-links a.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.sidebar-footer {
    padding-top: 0;
    border-top: none;
    margin-left: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: space-between;
}

.user-details {
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--primary-color);
}

.logout-btn {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
}

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

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px;
    background: linear-gradient(180deg, var(--bg-dark) 0%, #151821 100%);
}

.page-header {
    margin-bottom: 40px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
}

.page-header p {
    color: var(--text-muted);
    margin-top: 8px;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.action-card {
    padding: 24px;
    transition: all 0.3s ease;
}

.action-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-4px);
}

.action-card h3 {
    font-size: 18px;
    margin-bottom: 12px;
}

.action-card p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* --- MOBILE RESPONSIVE GLOBAL --- */
@media (max-width: 768px) {
    /* Adaptar Menú Superior */
    .sidebar { flex-direction: column !important; align-items: stretch !important; gap: 15px; }
    .sidebar-header { text-align: center; margin-right: 0 !important; }
    .nav-links { flex-wrap: wrap; justify-content: center; gap: 10px !important; }
    .sidebar-footer { margin-left: 0 !important; justify-content: space-between !important; width: 100%; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 15px !important; }
    
    /* Desbloquear altura y scroll nativo de la página */
    .dashboard-layout { height: auto !important; min-height: 100vh; }
    .main-content { height: auto !important; overflow: visible !important; flex-direction: column !important; }
    
    /* Apilar paneles divididos (Cotizador y Clientes) */
    .split-layout, .main-content[style*="display: flex"] { flex-direction: column !important; max-height: none !important; }
    .glass { max-width: 100% !important; flex: none !important; height: auto !important; overflow: visible !important; }
    
    /* Listas fluyentes */
    #saasList, #cartList, #clientListContainer { flex: none !important; height: auto !important; overflow: visible !important; min-height: 150px; }

    /* Specifics for inputs and action buttons in toolbars */
    .action-card .btn-primary, .search-toolbar .btn-secondary { width: 100% !important; margin-bottom: 5px; }
    .action-card input, .action-card select { width: 100% !important; }
    .search-toolbar { flex-direction: column !important; }
    #searchSaaS { padding: 12px 15px !important; font-size: 16px !important; min-height: 44px; }
}
