/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Variables CSS - Tema Elegante y Minimalista */
:root {
    /* Paleta de Colores Exquisita */
    --primary: #0f172a;
    --primary-rgb: 15, 23, 42;
    /* Added for opacity control */

    /* Slate 900 - Profundo y profesional */
    --primary-light: #334155;
    /* Slate 700 */
    --accent: #3b82f6;
    /* Blue 500 - Toque vibrante moderado */
    --accent-hover: #2563eb;
    /* Blue 600 */

    --bg-body: #f8fafc;
    /* Slate 50 */
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;

    --text-main: #1e293b;
    /* Slate 800 */
    --text-muted: #64748b;
    /* Slate 500 */
    --text-light: #94a3b8;
    /* Slate 400 */

    --border: #94a3b8;
    /* Darkened from #cbd5e1 (Slate 300) to Slate 400 */

    /* Slate 300 - Un poco más oscuro para mejor contraste en formularios */
    /* Slate 200 */
    --border-light: #cbd5e1;
    /* Also slightly darkened from #f1f5f9 */
    /* Slate 100 */

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Sombras Suaves (Glassy/Modern) */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Radios */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;

    /* Transiciones */
    --transition: all 0.2s ease-in-out;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 70px;
}

/* Reset Moderno */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    overflow: hidden;
    /* App-like feel */
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

button {
    font-family: inherit;
}

/* Layout Structure */
.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transition: var(--transition);
    z-index: 50;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    /* Changed to column to stack logo and name */
    align-items: center;
    /* Center align */
    justify-content: center;
    gap: 0.5rem;
    letter-spacing: -0.025em;
    text-align: center;
}

.brand img {
    max-width: 100%;
    max-height: 60px;
    object-fit: contain;
}

.brand i {
    font-size: 2rem;
    /* Larger icon if no logo */
    color: var(--accent);
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.nav-item:hover {
    background-color: rgba(var(--primary-rgb), 0.08);
    /* Primary color low opacity */
    color: var(--primary);
}

.nav-item.active {
    background-color: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-md);
}

.nav-item i {
    font-size: 1.1rem;
}

.user-profile {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 40px;
    height: 40px;
    background-color: var(--border-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Header Styling */
.top-header {
    height: var(--header-height);
    background-color: var(--bg-card);
    /* Glassmorphism effect mainly relies on opacity but solid white is cleaner */
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
    /* Changed from text-main to primary */
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Content Page Wrapper */
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background-color: var(--bg-body);
}

/* Componentes: Cards */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-light);
}

/* Componentes: Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--primary-light);
    box-shadow: var(--shadow-md);
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    background-color: rgba(var(--primary-rgb), 0.08);
    /* Primary color low opacity */
    color: var(--text-main);
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        padding: 1rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .nav-menu {
        display: none;
        /* Mobile menu hidden by default - to be implemented */
    }

    .mobile-menu-toggle {
        display: block;
    }

    .brand {
        margin-bottom: 0;
        flex-direction: row;
    }

    .main-content {
        height: calc(100vh - 70px);
        /* Adjust based on sidebar height */
    }
}

/* Utilities */
.text-sm {
    font-size: 0.875rem;
}

.text-muted {
    color: var(--text-muted);
}

.text-primary {
    color: var(--primary);
}

.text-main {
    color: var(--text-main);
}

.text-danger {
    color: var(--danger);
}

.font-bold {
    font-weight: 700;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-start {
    justify-content: flex-start;
}

.w-full {
    width: 100%;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-5 {
    margin-bottom: 1.25rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mb-8 {
    margin-bottom: 2.5rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-5 {
    margin-top: 1.25rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.mt-8 {
    margin-top: 2.5rem;
}

.pb-4 {
    padding-bottom: 1rem;
}

.grid {
    display: grid;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* Gaps */
.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

/* Dashboard Specifics (Ejemplo) */
.stat-card {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0.5rem 0;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Tabla de Datos Modernas */
.table-container {
    overflow-x: auto;
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: left;
}

.data-table th,
.data-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.data-table th {
    background-color: #f8fafc;
    /* Lighter slate */
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background-color: rgba(var(--primary-rgb), 0.08);
    /* Primary color low opacity */
}

/* Acciones en Tabla */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: var(--transition);
    border: none;
    background-color: transparent;
    cursor: pointer;
}

.btn-icon:hover {
    background-color: var(--border-light);
    color: var(--primary);
}

.btn-icon.edit:hover {
    background-color: #eff6ff;
    color: #3b82f6;
}

/* Blue tint */
.btn-icon.delete:hover {
    background-color: #fef2f2;
    color: #ef4444;
}

/* Red tint */

/* Sub-navegación para Datos Maestros */
.sub-nav {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sub-nav-item {
    white-space: nowrap;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.sub-nav-item:hover {
    color: var(--primary);
    background-color: rgba(var(--primary-rgb), 0.08);
    /* Primary color low opacity */
}

.sub-nav-item.active {
    color: var(--primary);
    background-color: rgba(var(--primary-rgb), 0.08);
    /* Primary color low opacity */
    font-weight: 600;
}

/* Input File Escondido */
.hidden-file-input {
    display: none;
}

/* Perfil Modal Color Picker */
.settings-panel {
    position: fixed;
    top: 70px;
    /* Header height */
    right: 0;
    width: 300px;
    height: calc(100vh - 70px);
    background-color: var(--bg-card);
    border-left: 1px solid var(--border);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 100;
}

.settings-panel.open {
    transform: translateX(0);
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.color-preview {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
    cursor: pointer;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-sm);
    background-color: var(--primary);
}

.color-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    margin: 0;
    padding: 0;
}

/* Factura Compact Client Section */
.client-info-compact .info-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.client-info-compact .client-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.client-info-compact .info-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.client-info-compact .info-item i {
    color: var(--accent);
}

/* Modal Component */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    border: 1px solid var(--border);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* CSS que faltaba para los formularios */
.form-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Sistema de columnas */
.col-1 {
    grid-column: span 1;
}

.col-2 {
    grid-column: span 2;
}

.col-3 {
    grid-column: span 3;
}

.col-4 {
    grid-column: span 4;
}

.col-5 {
    grid-column: span 5;
}

.col-6 {
    grid-column: span 6;
}

.col-8 {
    grid-column: span 8;
}

.col-9 {
    grid-column: span 9;
}

.col-10 {
    grid-column: span 10;
}

.col-12 {
    grid-column: span 12;
}

/* Responsive adjustments */
@media (max-width: 768px) {

    .col-1,
    .col-2,
    .col-3,
    .col-4,
    .col-5,
    .col-6,
    .col-8,
    .col-9,
    .col-10 {
        grid-column: span 12;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-top: 1.5rem;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-main);
    background-color: #fff;
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input[readonly] {
    background-color: var(--bg-body);
    color: var(--text-muted);
    cursor: not-allowed;
}

.hidden {
    display: none !important;
}

.max-w-form {
    max-width: 850px;

    /* Ancho más contenido para lectura cómoda */
    margin: 0 auto;
    /* Centrar horizontalmente */
}

/* Autocomplete List */
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 50;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.autocomplete-list.active {
    display: block;
}

.autocomplete-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-light);
}

.autocomplete-item:hover {
    background-color: rgba(var(--primary-rgb), 0.08);
    /* Primary color low opacity */
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item strong {
    color: var(--primary);
    display: block;
}

.autocomplete-item small {
    color: var(--text-muted);
}

/* Seamless Inputs for Table */
.seamless-input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text-main);
    outline: none;
}

.seamless-input:focus {
    background-color: #fff;
    box-shadow: inset 0 0 0 2px var(--accent);
}

/* Pill Button Style */
.btn-pill {
    padding: 0.4rem 1rem;
    border-radius: 99px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.text-center {
    text-align: center;
}


.text-right {
    text-align: right;
}

/* Subscription & Packages */
.balance-card {
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.balance-card:hover {
    box-shadow: var(--shadow-md);
}

.hover-effect {
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.hover-effect:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.w-100 {
    width: 100%;
}

.text-uppercase {
    text-transform: uppercase;
}