/**
 * VOCAL.li Dashboard - Custom Styles
 * 
 * Additional styles beyond Tailwind CSS
 */

/* ==================== ROOT VARIABLES ==================== */

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --accent: #3b82f6;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    
    /* Animations */
    --transition-fast: 150ms;
    --transition-normal: 200ms;
    --transition-slow: 300ms;
}

/* ==================== GLOBAL STYLES ==================== */

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(30, 41, 59, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(71, 85, 105, 0.8);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.9);
}

/* Hide scrollbar but keep functionality */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Selection color */
::selection {
    background: rgba(59, 130, 246, 0.3);
    color: #f1f5f9;
}

/* Focus styles */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ==================== NAVIGATION ==================== */

.nav-tab {
    color: #94a3b8;
    transition: all var(--transition-normal) ease;
}

.nav-tab:hover {
    background: rgba(51, 65, 85, 0.5);
    color: #e2e8f0;
}

.nav-tab.active {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

/* ==================== CARDS ==================== */

.card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 0.75rem;
    transition: all var(--transition-normal) ease;
}

.card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.card-glow {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}

/* ==================== BUTTONS ==================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all var(--transition-fast) ease;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: rgba(51, 65, 85, 0.5);
    color: #e2e8f0;
    border: 1px solid rgba(71, 85, 105, 0.5);
}

.btn-secondary:hover {
    background: rgba(51, 65, 85, 0.8);
    border-color: rgba(100, 116, 139, 0.5);
}

/* ==================== INPUTS ==================== */

input, select, textarea {
    transition: all var(--transition-fast) ease;
}

input:focus, select:focus, textarea:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Phone input with flag */
.phone-input-wrapper {
    position: relative;
}

.phone-input-wrapper::before {
    content: "📞";
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
}

/* ==================== TOGGLE SWITCH ==================== */

.toggle {
    position: relative;
    display: inline-flex;
    height: 1.5rem;
    width: 2.75rem;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: 9999px;
    border: 2px solid transparent;
    transition: all var(--transition-normal) ease;
}

.toggle-handle {
    pointer-events: none;
    display: inline-block;
    height: 1.25rem;
    width: 1.25rem;
    transform: translateX(0);
    border-radius: 9999px;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform var(--transition-normal) ease;
}

.toggle.active .toggle-handle {
    transform: translateX(1.25rem);
}

/* ==================== STATUS INDICATORS ==================== */

.status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
}

.status-dot.online {
    background: #10b981;
    animation: pulse-green 2s infinite;
}

.status-dot.offline {
    background: #ef4444;
}

.status-dot.pending {
    background: #f59e0b;
    animation: pulse-amber 2s infinite;
}

@keyframes pulse-green {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
}

@keyframes pulse-amber {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(245, 158, 11, 0);
    }
}

/* ==================== CHARTS ==================== */

.chart-container {
    position: relative;
    height: 200px;
}

/* ==================== MODALS ==================== */

.modal-backdrop {
    backdrop-filter: blur(4px);
}

.modal-content {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== TOASTS ==================== */

.toast {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-exit {
    animation: slideOutRight 0.3s ease-out forwards;
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ==================== SKELETON LOADING ==================== */

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(51, 65, 85, 0.5) 25%,
        rgba(71, 85, 105, 0.5) 50%,
        rgba(51, 65, 85, 0.5) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ==================== PROSE STYLES (for documentation) ==================== */

.prose h1:first-child {
    margin-top: 0;
}

.prose pre {
    margin: 0;
}

.prose pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

.prose table {
    font-size: 0.875rem;
}

.prose blockquote {
    font-style: italic;
    border-left: 3px solid #3b82f6;
    padding-left: 1rem;
}

/* ==================== TIMELINE ==================== */

.timeline-node {
    position: relative;
    z-index: 10;
}

.timeline-node::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 9999px;
    transform: translate(-50%, -50%);
}

.timeline-node.current::after {
    background: rgba(59, 130, 246, 0.3);
    animation: pulse 2s infinite;
}

/* ==================== RESPONSIVE HELPERS ==================== */

@media (max-width: 640px) {
    .card {
        border-radius: 0.5rem;
    }
    
    .nav-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* ==================== PRINT STYLES ==================== */

@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .nav-tab,
    .btn,
    header,
    footer,
    .toast-container {
        display: none !important;
    }
    
    .card {
        border: 1px solid #e5e7eb !important;
        box-shadow: none !important;
    }
}

/* ==================== DARK MODE ADJUSTMENTS ==================== */

.dark body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* ==================== GRADIENT TEXT ==================== */

.gradient-text {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==================== GLASS EFFECT ==================== */

.glass {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ==================== HOVER EFFECTS ==================== */

.hover-lift {
    transition: transform var(--transition-normal) ease, box-shadow var(--transition-normal) ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

/* ==================== LOADING STATES ==================== */

.loading-dots::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* ==================== CALL STATUS ANIMATION ==================== */

.call-ringing {
    animation: ring 1s ease-in-out infinite;
}

@keyframes ring {
    0%, 100% {
        transform: rotate(-5deg);
    }
    50% {
        transform: rotate(5deg);
    }
}

.call-active {
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(16, 185, 129, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.8);
    }
}

/* ==================== WORKFLOW CARD STYLES ==================== */

.workflow-card {
    transition: all var(--transition-normal) ease;
}

.workflow-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.workflow-card.active {
    border-color: rgba(16, 185, 129, 0.5);
}

.workflow-card.inactive {
    opacity: 0.7;
}

/* ==================== PHASE PROGRESS ==================== */

.phase-progress {
    transition: width 0.5s ease-out;
}

/* ==================== ACCESSIBILITY ==================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .card {
        border-width: 2px;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}
