/* 
 * assets/css/styles.css
 * Hoja de estilos principal (Desktop First)
 */

:root {
    --primary-color: #0f172a; /* Slate 900 */
    --secondary-color: #3b82f6; /* Blue 500 */
    --bg-color: #f8fafc; /* Slate 50 */
    --text-main: #1e293b; /* Slate 800 */
    --text-muted: #64748b; /* Slate 500 */
    --border-color: #e2e8f0; /* Slate 200 */
    
    /* Heatmap Colors for Lead Score */
    --score-cold: #cbd5e1; /* Slate 300 */
    --score-warm: #fef08a; /* Yellow 200 */
    --score-hot:  #fca5a5; /* Red 300 */
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    background-color: var(--primary-color);
    color: white;
    padding-top: 0;
    transition: width 0.3s ease;
    overflow: hidden;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    min-height: 60px;
}

.sidebar-header .sidebar-brand {
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    font-size: 1.1rem;
    font-weight: 600;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar a {
    color: #cbd5e1;
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 12px 20px;
    transition: background 0.2s, color 0.2s, padding 0.3s;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar a i {
    min-width: 20px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar a .sidebar-text {
    margin-left: 10px;
    transition: opacity 0.2s;
}

.sidebar a:hover, .sidebar a.active {
    background-color: rgba(255,255,255,0.1);
    color: white;
}

/* Collapsed sidebar */
.sidebar.collapsed {
    width: 60px;
}

.sidebar.collapsed .sidebar-brand .sidebar-text {
    opacity: 0;
    width: 0;
}

.sidebar.collapsed a .sidebar-text {
    opacity: 0;
    width: 0;
}

.sidebar.collapsed a {
    padding: 12px 0;
    justify-content: center;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 15px 8px;
}

.sidebar.collapsed .sidebar-brand {
    display: none;
}

.sidebar.collapsed .sidebar-logout .sidebar-text {
    opacity: 0;
    width: 0;
}

.sidebar.collapsed .sidebar-logout {
    justify-content: center;
    padding: 12px 0;
}

/* Tooltip for collapsed sidebar */
.sidebar.collapsed a[title] {
    position: relative;
}

/* HTML class based collapsed state for early load flicker prevention */
.sidebar-collapsed .sidebar {
    width: 60px;
}
.sidebar-collapsed .main-content {
    margin-left: 60px;
}
.sidebar-collapsed .sidebar-text {
    display: none;
}

/* No transition utility to prevent flash/sliding on load */
.no-transition, .no-transition * {
    transition: none !important;
}

/* Main Content Area */
.main-content {
    margin-left: 250px;
    padding: 0 30px 30px 30px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 60px;
}

/* Sticky Page Header */
.page-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--bg-color);
    padding: 20px 0 15px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

/* Sticky Table Headers (global) */
.main-content .table-responsive {
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}

.main-content thead th {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Responsive (Since it's Desktop First) */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    .main-content {
        margin-left: 0;
    }
}

/* Kanban specific styles */
.kanban-board {
    display: flex;
    overflow-x: auto;
    padding-bottom: 20px;
    gap: 15px;
}

.kanban-col {
    min-width: 300px;
    background-color: #f1f5f9;
    border-radius: 6px;
    padding: 10px;
}

.kanban-card {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: grab;
}

/* Auth Cards */
.login-card {
    max-width: 400px;
    margin: 10vh auto;
    padding: 40px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

/* Inline Editable Component */
.inline-editable {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--text-main);
    resize: none;
    overflow: hidden;
    transition: border-color 0.2s, background-color 0.3s, box-shadow 0.2s;
    line-height: 1.4;
}

.inline-editable:hover {
    border-color: var(--border-color);
    background: #f8fafc;
}

.inline-editable:focus {
    outline: none;
    border-color: var(--secondary-color);
    background: white;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.inline-editable.ie-saving {
    opacity: 0.6;
}

.inline-editable.ie-success {
    background-color: #d1fae5 !important;
    border-color: #10b981 !important;
    transition: background-color 0.15s;
}

.inline-editable.ie-error {
    background-color: #fee2e2 !important;
    border-color: #ef4444 !important;
}

/* Global API Loader */
#global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    pointer-events: none !important;
    opacity: 0;
    transition: opacity 0.25s ease;
}

#global-loader.active {
    opacity: 1;
}

/* Hide the old fullscreen backdrop overlay */
.loader-backdrop {
    display: none;
}

/* Rainbow border effect (soft organic curves) */
#global-loader::before,
#global-loader::after {
    content: '';
    position: absolute;
    inset: -10vw; /* overflow for hardware-accelerated heartbeat scaling */
    pointer-events: none;
    -webkit-mask-image: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.4) 65%, #000 95%);
    mask-image: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.4) 65%, #000 95%);
}

#global-loader::before {
    background-image: 
        radial-gradient(circle at 10% 10%, rgba(255, 0, 85, 0.8) 0%, transparent 50%),
        radial-gradient(circle at 90% 20%, rgba(0, 240, 255, 0.8) 0%, transparent 50%),
        radial-gradient(circle at 80% 85%, rgba(127, 0, 255, 0.8) 0%, transparent 55%),
        radial-gradient(circle at 15% 80%, rgba(255, 170, 0, 0.8) 0%, transparent 50%);
    filter: blur(40px);
    animation: fluid-curves-1 7s ease-in-out infinite alternate, heartbeat-before 1.8s ease-in-out infinite;
    z-index: 1;
}

#global-loader::after {
    background-image: 
        radial-gradient(circle at 90% 10%, rgba(51, 255, 0, 0.7) 0%, transparent 45%),
        radial-gradient(circle at 10% 90%, rgba(255, 0, 255, 0.7) 0%, transparent 45%),
        radial-gradient(circle at 50% 5%, rgba(0, 34, 255, 0.7) 0%, transparent 50%);
    filter: blur(55px);
    opacity: 0.75;
    animation: fluid-curves-2 5.5s ease-in-out infinite alternate, heartbeat-after 1.8s ease-in-out infinite;
    z-index: 2;
}

/* Sleek floating glassmorphic pill at the top center */
.loader-content {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    opacity: 0;
    z-index: 10000;
    background: rgba(15, 23, 42, 0.85); /* Slate 900 con transparencia */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 8px 16px;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

#global-loader.active .loader-content {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Compact spinner inside the pill */
.loader-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top: 2px solid #3b82f6; /* Blue 500 */
    border-radius: 50%;
    animation: loader-spin 0.6s linear infinite;
    flex-shrink: 0;
}

/* Text style inside the pill */
.loader-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Organic morphing color blobs for Layer 1 */
@keyframes fluid-curves-1 {
    0% {
        background-image: 
            radial-gradient(circle at 10% 10%, rgba(255, 0, 85, 0.8) 0%, transparent 50%),
            radial-gradient(circle at 90% 20%, rgba(0, 240, 255, 0.8) 0%, transparent 50%),
            radial-gradient(circle at 80% 85%, rgba(127, 0, 255, 0.8) 0%, transparent 55%),
            radial-gradient(circle at 15% 80%, rgba(255, 170, 0, 0.8) 0%, transparent 50%);
    }
    50% {
        background-image: 
            radial-gradient(circle at 35% 35%, rgba(255, 0, 85, 0.8) 0%, transparent 55%),
            radial-gradient(circle at 65% 15%, rgba(0, 240, 255, 0.8) 0%, transparent 45%),
            radial-gradient(circle at 65% 75%, rgba(127, 0, 255, 0.8) 0%, transparent 50%),
            radial-gradient(circle at 15% 65%, rgba(255, 170, 0, 0.8) 0%, transparent 55%);
    }
    100% {
        background-image: 
            radial-gradient(circle at -10% 20%, rgba(255, 0, 85, 0.8) 0%, transparent 45%),
            radial-gradient(circle at 110% 10%, rgba(0, 240, 255, 0.8) 0%, transparent 55%),
            radial-gradient(circle at 80% 110%, rgba(127, 0, 255, 0.8) 0%, transparent 45%),
            radial-gradient(circle at 20% 80%, rgba(255, 170, 0, 0.8) 0%, transparent 50%);
    }
}

/* Organic morphing color blobs for Layer 2 */
@keyframes fluid-curves-2 {
    0% {
        background-image: 
            radial-gradient(circle at 90% 10%, rgba(51, 255, 0, 0.7) 0%, transparent 45%),
            radial-gradient(circle at 10% 90%, rgba(255, 0, 255, 0.7) 0%, transparent 45%),
            radial-gradient(circle at 50% 5%, rgba(0, 34, 255, 0.7) 0%, transparent 50%);
    }
    50% {
        background-image: 
            radial-gradient(circle at 80% 25%, rgba(51, 255, 0, 0.7) 0%, transparent 50%),
            radial-gradient(circle at 20% 75%, rgba(255, 0, 255, 0.7) 0%, transparent 50%),
            radial-gradient(circle at 40% 15%, rgba(0, 34, 255, 0.7) 0%, transparent 45%);
    }
    100% {
        background-image: 
            radial-gradient(circle at 95% 5%, rgba(51, 255, 0, 0.7) 0%, transparent 40%),
            radial-gradient(circle at 5% 95%, rgba(255, 0, 255, 0.7) 0%, transparent 50%),
            radial-gradient(circle at 60% -5%, rgba(0, 34, 255, 0.7) 0%, transparent 55%);
    }
}

/* Heartbeat pulse with slight clock-wise rotation for Layer 1 */
@keyframes heartbeat-before {
    0%, 100% {
        transform: scale(1) rotate(0deg) translate3d(0, 0, 0);
        opacity: 0.75;
    }
    15% {
        transform: scale(1.06) rotate(1.5deg) translate3d(0, 0, 0);
        opacity: 0.95;
    }
    30% {
        transform: scale(1.02) rotate(0.5deg) translate3d(0, 0, 0);
        opacity: 0.8;
    }
    45% {
        transform: scale(1.09) rotate(-1.5deg) translate3d(0, 0, 0);
        opacity: 0.95;
    }
    70% {
        transform: scale(1) rotate(0deg) translate3d(0, 0, 0);
        opacity: 0.75;
    }
}

/* Heartbeat pulse with counter-clockwise rotation for Layer 2 */
@keyframes heartbeat-after {
    0%, 100% {
        transform: scale(1) rotate(0deg) translate3d(0, 0, 0);
        opacity: 0.7;
    }
    15% {
        transform: scale(1.08) rotate(-2deg) translate3d(0, 0, 0);
        opacity: 0.95;
    }
    30% {
        transform: scale(1.03) rotate(-0.5deg) translate3d(0, 0, 0);
        opacity: 0.75;
    }
    45% {
        transform: scale(1.11) rotate(2deg) translate3d(0, 0, 0);
        opacity: 0.95;
    }
    70% {
        transform: scale(1) rotate(0deg) translate3d(0, 0, 0);
        opacity: 0.7;
    }
}

/* Spinner rotation */
@keyframes loader-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}



