@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --primary-gradient: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    --accent-gradient: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --primary: #1e3c72;
    --primary-light: #eff6ff;
    --accent: #0072ff;
    
    /* Semantic Colors */
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --error: #ef4444;
    --error-light: #fef2f2;
    --info: #3b82f6;
    --info-light: #eff6ff;
    --pending: #f97316;
    --pending-light: #fff7ed;

    /* Shadow tokens */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.02);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.06), 0 10px 10px -5px rgba(0,0,0,0.04);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header & Navigation */
header {
    background: var(--primary-gradient);
    color: #ffffff;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo span {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 15px;
}

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

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(30, 60, 114, 0.2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(30, 60, 114, 0.3);
}

.btn-accent {
    background: var(--accent-gradient);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 114, 255, 0.2);
}

.btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(0, 114, 255, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary-light);
}

.btn-outline-white {
    background: transparent;
    color: #ffffff;
    border: 1.5px solid rgba(255,255,255,0.4);
}

.btn-outline-white:hover {
    border-color: #ffffff;
    background: rgba(255,255,255,0.1);
}

.btn-danger {
    background: var(--error);
    color: #ffffff;
}

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

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

.btn-success:hover {
    background: #059669;
}

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

/* Cards & Layouts */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 20px;
}

/* Buscador Principal & FAQs */
.hero-section {
    background: var(--primary-gradient);
    color: #ffffff;
    padding: 60px 0;
    text-align: center;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    margin-bottom: 40px;
}

.hero-title {
    font-size: 40px;
    margin-bottom: 15px;
    font-weight: 800;
}

.hero-subtitle {
    font-size: 18px;
    color: rgba(255,255,255,0.8);
    margin-bottom: 30px;
}

.search-box-container {
    max-width: 650px;
    margin: 0 auto;
    display: flex;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    padding: 8px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.2);
}

.search-input {
    flex: 1;
    background: #ffffff;
    border: none;
    padding: 12px 20px;
    border-top-left-radius: var(--radius-sm);
    border-bottom-left-radius: var(--radius-sm);
    font-size: 16px;
    outline: none;
}

.search-btn {
    background: var(--accent-gradient);
    color: #ffffff;
    border: none;
    padding: 0 25px;
    font-weight: 600;
    border-top-right-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
}

.search-btn:hover {
    filter: brightness(1.1);
}

.category-chips {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.chip {
    padding: 6px 15px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 20px;
    color: #ffffff;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.chip:hover, .chip.active {
    background: #ffffff;
    color: var(--primary);
    border-color: #ffffff;
}

.kb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 60px;
}

.kb-card {
    cursor: pointer;
}

.kb-card h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--primary);
}

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

.kb-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-info { background: var(--info-light); color: var(--info); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-error { background: var(--error-light); color: var(--error); }
.badge-pending { background: var(--pending-light); color: var(--pending); }

/* Forms & Inputs */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 114, 255, 0.15);
}

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

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-card);
    width: 100%;
    max-width: 600px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.25s ease;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    background: var(--primary-gradient);
    color: #ffffff;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 15px 24px;
    background: var(--bg-main);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* WYSIWYG Editor */
.wysiwyg-container {
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: var(--transition);
}

.wysiwyg-container:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 114, 255, 0.15);
}

.wysiwyg-toolbar {
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    padding: 6px;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.wysiwyg-btn {
    background: transparent;
    border: none;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
}

.wysiwyg-btn:hover {
    background: #e2e8f0;
    color: var(--text-main);
}

.wysiwyg-editor {
    min-height: 150px;
    padding: 12px;
    outline: none;
    background: #ffffff;
    font-family: inherit;
    font-size: 14px;
    overflow-y: auto;
}

.wysiwyg-editor ul, .wysiwyg-editor ol {
    padding-left: 20px;
    margin-bottom: 10px;
}

/* Dashboard Grid */
.dashboard-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: calc(100vh - 70px);
}

aside.sidebar {
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.user-profile-badge {
    padding: 15px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    margin-bottom: 15px;
}

.user-profile-badge .email {
    font-weight: 600;
    font-size: 14px;
    word-break: break-all;
}

.user-profile-badge .role {
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    font-weight: bold;
    display: block;
    margin-top: 3px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
}

.sidebar-link:hover, .sidebar-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

main.main-content {
    padding: 30px;
    overflow-y: auto;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    padding: 20px;
    text-align: center;
}

.stat-val {
    font-size: 28px;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: bold;
}

/* Tables & Lists */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.table th {
    background: #f8fafc;
    padding: 12px 15px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
}

.table td {
    padding: 14px 15px;
    border-bottom: 1px solid var(--border-color);
}

.table tr:hover {
    background: #f8fafc;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 30px;
    margin: 20px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-dot {
    position: absolute;
    left: -26px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #ffffff;
}

.timeline-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.timeline-time {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
    margin-top: 5px;
}

/* Comments section */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.comment-card {
    border-left: 4px solid var(--primary);
}

.comment-card.internal {
    border-left-color: var(--pending);
    background: #fffaf0;
}

.comment-header {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.comment-header strong {
    color: var(--text-main);
}

.comment-body {
    font-size: 14px;
    line-height: 1.6;
}

/* Toast Alerts */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10000;
}

.toast {
    background: #ffffff;
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-xl);
    font-size: 14px;
    font-weight: 500;
    border-left: 4px solid var(--primary);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }
.toast.warning { border-left-color: var(--warning); }

/* File Uploader UI */
.file-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    background: #ffffff;
    transition: var(--transition);
}

.file-upload-zone:hover {
    border-color: var(--accent);
    background: var(--primary-light);
}

.file-list {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-size: 13px;
}

.file-remove {
    color: var(--error);
    cursor: pointer;
    font-weight: bold;
}

/* Spinner Loader */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive constraints */
@media(max-width: 768px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
    
    aside.sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 15px 20px;
    }
    
    .hero-title {
        font-size: 28px;
    }
}
