/* ═══════════════════════════════════════════════════════════════
   IPYDO LICENSE SERVER - Estilos v2.0
   Color corporativo: #F99C1F
   Inspirado en: https://ipydo.es
═══════════════════════════════════════════════════════════════ */

:root {
    /* Colores principales IPYDO */
    --ipydo-orange: #F99C1F;
    --ipydo-orange-hover: #e08a15;
    --ipydo-orange-light: rgba(249, 156, 31, 0.1);
    --ipydo-orange-border: rgba(249, 156, 31, 0.3);
    
    /* Colores de fondo */
    --bg-dark: #1a1a2e;
    --bg-darker: #16162a;
    --bg-card: #ffffff;
    --bg-light: #f8f9fa;
    --bg-sidebar: #1a1a2e;
    
    /* Colores de texto */
    --text-dark: #2d3748;
    --text-muted: #718096;
    --text-light: #ffffff;
    --text-sidebar: rgba(255, 255, 255, 0.8);
    
    /* Estados */
    --success: #48bb78;
    --warning: #F99C1F;
    --danger: #f56565;
    --info: #4299e1;
    
    /* Tipografía */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Espaciados */
    --sidebar-width: 260px;
    --header-height: 60px;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Reset y Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--bg-light);
}

/* Tipografía */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5em;
}

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

a {
    color: var(--ipydo-orange);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--ipydo-orange-hover);
}

/* ═══════════════════════════════════════════════════════════════
   LAYOUT PRINCIPAL
═══════════════════════════════════════════════════════════════ */

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    padding: 15px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo img {
    max-width: 120px;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-section-title {
    padding: 8px 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-sidebar);
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(249, 156, 31, 0.1);
    color: var(--text-light);
    border-left-color: var(--ipydo-orange);
}

.nav-item.active {
    background: rgba(249, 156, 31, 0.15);
    color: var(--ipydo-orange);
    border-left-color: var(--ipydo-orange);
}

.nav-item i {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    opacity: 0.8;
}

.nav-item.active i {
    opacity: 1;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 1rem 1.5rem;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-info i {
    width: 32px;
    height: 32px;
    color: var(--ipydo-orange);
}

.user-name {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
}

.user-role {
    display: block;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Contenido principal */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* Header */
.top-bar {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-dark);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

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

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background: var(--bg-light);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-menu:hover {
    background: var(--ipydo-orange-light);
}

/* Contenedor de página */
.content {
    padding: 30px;
}

.page-content {
    padding: 30px;
}

/* ═══════════════════════════════════════════════════════════════
   COMPONENTES - CARDS
═══════════════════════════════════════════════════════════════ */

.card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.card-body {
    padding: 25px;
}

.card-footer {
    padding: 15px 25px;
    background: var(--bg-light);
    border-top: 1px solid #e2e8f0;
}

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

.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 25px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ipydo-orange-light);
    color: var(--ipydo-orange);
}

.stat-icon.primary {
    background: rgba(66, 153, 225, 0.1);
    color: var(--info);
}

.stat-icon.success {
    background: rgba(72, 187, 120, 0.1);
    color: var(--success);
}

.stat-icon.warning {
    background: var(--ipydo-orange-light);
    color: var(--ipydo-orange);
}

.stat-icon.error {
    background: rgba(245, 101, 101, 0.1);
    color: var(--danger);
}

.stat-icon i {
    width: 28px;
    height: 28px;
}

.stat-info h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.stat-info p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 5px 0 0 0;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* ═══════════════════════════════════════════════════════════════
   COMPONENTES - BOTONES
═══════════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn i {
    width: 18px;
    height: 18px;
}

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

.btn-primary:hover {
    background: var(--ipydo-orange-hover);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 156, 31, 0.4);
}

.btn-accent {
    background: var(--ipydo-orange);
    color: white;
}

.btn-accent:hover {
    background: var(--ipydo-orange-hover);
    color: white;
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

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

.btn-danger:hover {
    background: #e53e3e;
}

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

.btn-success:hover {
    background: #38a169;
}

.btn-outline {
    background: white;
    border: 1px solid #e2e8f0;
    color: var(--text-dark);
}

.btn-outline:hover {
    background: var(--bg-light);
    border-color: var(--ipydo-orange);
    color: var(--ipydo-orange);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-sm i {
    width: 14px;
    height: 14px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--border-radius);
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   COMPONENTES - FORMULARIOS
═══════════════════════════════════════════════════════════════ */

.form-group {
    margin-bottom: 20px;
}

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

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    background: var(--bg-card);
    color: var(--text-dark);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--ipydo-orange);
    box-shadow: 0 0 0 3px var(--ipydo-orange-light);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Checkbox y Toggle */
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-check-input {
    width: 18px;
    height: 18px;
    accent-color: var(--ipydo-orange);
    cursor: pointer;
}

.toggle {
    position: relative;
    width: 50px;
    height: 26px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #cbd5e0;
    border-radius: 26px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked + .toggle-slider {
    background: var(--ipydo-orange);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* ═══════════════════════════════════════════════════════════════
   COMPONENTES - TABLAS
═══════════════════════════════════════════════════════════════ */

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

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

.table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-light);
    border-bottom: 2px solid #e2e8f0;
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.table tbody tr {
    transition: background 0.2s ease;
}

.table tbody tr:hover {
    background: var(--ipydo-orange-light);
}

.table-actions {
    display: flex;
    gap: 6px;
}

.actions {
    display: flex;
    gap: 6px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-dark);
}

.action-btn:hover {
    background: var(--ipydo-orange-light);
    border-color: var(--ipydo-orange);
    color: var(--ipydo-orange);
}

.action-btn.danger:hover {
    background: rgba(245, 101, 101, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

.action-btn i {
    width: 16px;
    height: 16px;
}

/* ═══════════════════════════════════════════════════════════════
   COMPONENTES - BADGES Y ESTADOS
═══════════════════════════════════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 20px;
}

.badge-success {
    background: rgba(72, 187, 120, 0.15);
    color: #22543d;
}

.badge-warning {
    background: rgba(249, 156, 31, 0.15);
    color: #744210;
}

.badge-danger {
    background: rgba(245, 101, 101, 0.15);
    color: #742a2a;
}

.badge-info {
    background: rgba(66, 153, 225, 0.15);
    color: #2a4365;
}

.badge-gray {
    background: #e2e8f0;
    color: var(--text-muted);
}

.badge-secondary {
    background: #e2e8f0;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════
   COMPONENTES - ALERTAS
═══════════════════════════════════════════════════════════════ */

.alert {
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert i {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.alert-success {
    background: rgba(72, 187, 120, 0.15);
    border: 1px solid rgba(72, 187, 120, 0.3);
    color: #22543d;
}

.alert-warning {
    background: rgba(249, 156, 31, 0.15);
    border: 1px solid rgba(249, 156, 31, 0.3);
    color: #744210;
}

.alert-error {
    background: rgba(245, 101, 101, 0.15);
    border: 1px solid rgba(245, 101, 101, 0.3);
    color: #742a2a;
}

.alert-danger {
    background: rgba(245, 101, 101, 0.15);
    border: 1px solid rgba(245, 101, 101, 0.3);
    color: #742a2a;
}

.alert-info {
    background: rgba(66, 153, 225, 0.15);
    border: 1px solid rgba(66, 153, 225, 0.3);
    color: #2a4365;
}

/* ═══════════════════════════════════════════════════════════════
   COMPONENTES - PAGINACIÓN
═══════════════════════════════════════════════════════════════ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

.pagination a, .pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    background: var(--bg-card);
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    text-decoration: none;
}

.pagination a:hover {
    background: var(--ipydo-orange-light);
    border-color: var(--ipydo-orange);
    color: var(--ipydo-orange);
}

.pagination .active {
    background: var(--ipydo-orange);
    color: white;
    border-color: var(--ipydo-orange);
}

.pagination-info {
    padding: 0 15px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════
   PÁGINA DE LOGIN
═══════════════════════════════════════════════════════════════ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-logo {
    text-align: center;
    margin-bottom: 40px;
    width: 100%;
}

.login-logo img {
    max-width: 250px;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-title {
    text-align: center;
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 30px;
}

.login-body {
    margin-top: 20px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

.login-form .btn-accent {
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

.login-footer {
    text-align: center;
    margin-top: 30px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
}

.login-box {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

/* ═══════════════════════════════════════════════════════════════
   COMPONENTES - LICENCIAS
═══════════════════════════════════════════════════════════════ */

.license-key {
    font-family: var(--font-mono);
    font-size: 13px;
    background: var(--bg-light);
    padding: 6px 12px;
    border-radius: var(--border-radius);
    border: 1px solid #e2e8f0;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.license-key .copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    transition: color 0.2s ease;
}

.license-key .copy-btn:hover {
    color: var(--ipydo-orange);
}

/* Filtros de licencia */
.license-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    background: var(--bg-card);
}

.show-inactive-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.manual-controls {
    background: var(--bg-light);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

/* ═══════════════════════════════════════════════════════════════
   UTILIDADES
═══════════════════════════════════════════════════════════════ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

.d-flex { display: flex; }
.flex { display: flex; }
.align-center { align-items: center; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

.hidden { display: none !important; }

.mono {
    font-family: var(--font-mono);
}

code.mono {
    font-family: var(--font-mono);
    background: var(--bg-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .page-content {
        padding: 15px;
    }
    
    .content {
        padding: 15px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .table-container {
        margin: 0 -15px;
    }
    
    .license-filters,
    .filters {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
}
