/* ========== CRM Cristal - Theme & Global Styles ========== */

:root {
    /* Fondos principales */
    --bg-light: #111111;
    --bg-white: #1a1a1a;
    --border-color: #2a2a2a;
    --bg-hover: #222222;

    /* Colores de acento */
    --primary-color: #3b82f6;
    --primary-hover: #1d4ed8;
    --primary-hover-alt: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;

    /* Textos */
    --text-dark: #f1f5f9;
    --text-light: #94a3b8;

    /* Badges */
    --badge-green-bg: #166534;
    --badge-green-text: #dcfce7;
    --badge-red-bg: #991b1b;
    --badge-red-text: #fee2e2;
    --badge-orange-bg: #9a3412;
    --badge-orange-text: #fed7aa;
    --badge-blue-bg: #1e40af;
    --badge-blue-text: #dbeafe;

    /* Highlights de fila */
    --highlight-green: #064e3b;
    --highlight-red: #7f1d1d;
    --highlight-blue: #1e3a8a;

    /* Header tabla */
    --table-header: #1e3a5f;

    /* Layout */
    --sidebar-width: 240px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-light);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* ========== Utilities ========== */
.hidden {
    display: none !important;
}

/* ========== Inputs ========== */
input, textarea, select {
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    color: var(--text-dark);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ========== Buttons ========== */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
}
.btn-secondary {
    background-color: var(--secondary-color);
    color: #fff;
}
.btn-danger {
    background-color: var(--danger-color);
    color: #fff;
}

/* ========== Badges ========== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.badge-green {
    background-color: var(--badge-green-bg);
    color: var(--badge-green-text);
}
.badge-red {
    background-color: var(--badge-red-bg);
    color: var(--badge-red-text);
}
.badge-orange {
    background-color: var(--badge-orange-bg);
    color: var(--badge-orange-text);
}
.badge-blue {
    background-color: var(--badge-blue-bg);
    color: var(--badge-blue-text);
}

/* ========== Main Content ========== */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 32px;
    flex: 1;
    min-height: 100vh;
}

/* ========== Modal (Global) ========== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: modalFadeIn 0.15s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 420px;
    max-width: 92vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.2s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

@keyframes modalSlideIn {
    from { transform: translateY(-12px) scale(0.97); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

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

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
}

.modal-close {
    width: 32px; height: 32px;
    border: none;
    background: none;
    color: var(--text-light);
    font-size: 20px;
    cursor: pointer;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-dark);
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.modal-field label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    margin-bottom: 6px;
}

.modal-field select,
.modal-field textarea,
.modal-field input {
    width: 100%;
}

.modal-field textarea {
    min-height: 70px;
    resize: vertical;
}

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

.modal-footer .btn {
    min-width: 90px;
    justify-content: center;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.section-header h2 {
    font-size: 24px;
    font-weight: 700;
}

.search-input {
    width: 280px;
    padding: 8px 14px;
    border-radius: 8px;
}
