/**
 * SOMOS CONTENIDO - Estilos Enterprise
 * Diseño profesional, limpio y escalable.
 */

:root {
    /* Paleta Enterprise Dark */
    --bg-body: #0f1115;
    /* Fondo principal muy oscuro pero no negro puro */
    --bg-card: #161b22;
    /* Fondo de tarjetas/paneles */
    --bg-card-hover: #1c2128;
    /* Hover en elementos */
    --bg-input: #0d1117;
    /* Fondo de inputs */

    --border: #30363d;
    /* Bordes sutiles */
    --border-light: #444c56;

    /* Tipografía */
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;

    /* Acentos */
    --primary: #da3633;
    /* Rojo corporativo ajustado */
    --primary-hover: #f85149;
    --primary-soft: rgba(218, 54, 51, 0.15);

    --success: #238636;
    --success-hover: #2ea043;

    --danger: #da3633;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- Layout --- */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    /* Reduced top padding */
}

/* --- Header --- */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0;
    /* Increased vertical padding */
    margin-bottom: 1.5rem;
    /* Reduced margin bottom */
    box-shadow: var(--shadow-sm);
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, #a01830 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: white;
    box-shadow: 0 2px 4px rgba(218, 54, 51, 0.3);
}

.logo h2 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 50px;
    /* Pill shape */
    transition: 0.2s border;
}

.user-badge:hover {
    border-color: var(--text-secondary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--bg-card);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    background: transparent;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: rgba(240, 246, 252, 0.1);
    box-shadow: 0 1px 0 rgba(27, 31, 36, 0.1);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: #21262d;
    border-color: var(--text-secondary);
}

.btn-outline {
    border-color: var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* Icon button variant */
.btn-icon {
    padding: 0.4rem;
    width: 32px;
    height: 32px;
    color: var(--text-secondary);
    border-color: transparent;
    background: transparent;
}

.btn-icon:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-icon.delete:hover {
    background: rgba(218, 54, 51, 0.2);
    color: var(--danger);
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card.mb-3 {
    margin-bottom: 1rem;
}

.card.mb-4 {
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    margin: -1.5rem -1.5rem 1.5rem -1.5rem;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    /* Opcional: fondo igual o ligeramente distinto */
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* --- Table --- */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    background: #0d1117;
    text-align: left;
    padding: 0.75rem 1.25rem;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: var(--bg-card-hover);
}

.table a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.15s;
}

.table a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Link especial para acciones primarias dentro de table */
.action-link {
    color: #58a6ff;
    /* Azul GitHub/Tech */
    font-weight: 500;
}

.action-link:hover {
    text-decoration: underline;
}

/* --- Inputs --- */
.input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border 0.15s;
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(218, 54, 51, 0.15);
}

.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: rgba(1, 4, 9, 0.85);
    /* Fondo más oscuro */
    backdrop-filter: blur(2px);
    overflow-y: auto;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

/* --- Utilidades --- */
.text-muted {
    color: var(--text-muted) !important;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    z-index: 9999;
}

/* Spinner */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* SVGs */
.icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
    display: inline-block;
    vertical-align: text-top;
}

.icon-lg {
    width: 20px;
    height: 20px;
}

/* --- Utilities (Restored for ImageOptimizer) --- */
.p-0 {
    padding: 0 !important;
}

.p-2 {
    padding: 0.5rem !important;
}

.p-3 {
    padding: 1rem !important;
}

.p-4 {
    padding: 1.5rem !important;
}

.p-5 {
    padding: 3rem !important;
}

.pt-3 {
    padding-top: 1rem !important;
}

.pb-2 {
    padding-bottom: 0.5rem !important;
}

.mt-auto {
    margin-top: auto !important;
}

.w-100 {
    width: 100% !important;
}

.w-auto {
    width: auto !important;
}

.h-100 {
    height: 100% !important;
}

.flex-1 {
    flex: 1;
}

.flex-column {
    flex-direction: column;
}

.justify-between {
    justify-content: space-between;
}

.flex-end {
    display: flex;
    justify-content: flex-end;
}

.overflow-auto {
    overflow: auto;
}

.bg-secondary {
    background-color: var(--bg-card-hover) !important;
}

.bg-primary-light {
    background-color: var(--primary-soft) !important;
}

.bg-black {
    background-color: #000;
}

.text-center {
    text-align: center;
}

.text-white {
    color: white;
}

.border-bottom {
    border-bottom: 1px solid var(--border);
}

.border-primary {
    border-color: var(--primary) !important;
}

.rounded {
    border-radius: var(--radius-md);
}

.cursor-pointer {
    cursor: pointer;
}

/* Grid Utilities */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

/* Notification Pulse Animation */
@keyframes pulse-notification {
    0% {
        box-shadow: 0 8px 32px rgba(59, 130, 246, 0.5), 0 0 0 0 rgba(59, 130, 246, 0.7);
    }

    50% {
        box-shadow: 0 8px 32px rgba(59, 130, 246, 0.5), 0 0 0 12px rgba(59, 130, 246, 0);
    }

    100% {
        box-shadow: 0 8px 32px rgba(59, 130, 246, 0.5), 0 0 0 0 rgba(59, 130, 246, 0);
    }

}

/* Alerts & Badges */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    border: 1px solid transparent;
}

.alert-danger {
    background: rgba(218, 54, 51, 0.1);
    border-color: rgba(218, 54, 51, 0.2);
    color: #ff7b72;
}

.alert-info {
    background: rgba(56, 139, 253, 0.1);
    border-color: rgba(56, 139, 253, 0.2);
    color: #79c0ff;
}

.alert-success {
    background: rgba(46, 160, 67, 0.1);
    border-color: rgba(46, 160, 67, 0.2);
    color: #7ee787;
}

.badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    border-radius: 20px;
    background: var(--bg-card-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}