/**
 * OlonPOS Dashboard - Estilos personalizados
 * Complementa TailwindCSS con estilos específicos del dashboard
 */

:root {
    /* Brand Colors - Espresso Café */
    --olon-accent: #C7923E;
    --olon-espresso: #2B1B17;
    --olon-blue: #4834d4;
    --olon-bosque: #4E6E53;

    /* Alias: backward-compat for templates using hanami-pink / hanami-purple */
    --hanami-pink: #C7923E;
    --hanami-purple: #2B1B17;
    --hanami-accent: #C7923E;
    --hanami-espresso: #2B1B17;

    /* Extended Color Palette */
    --color-primary: #C7923E;
    --color-primary-light: #E0B56E;
    --color-primary-dark: #A67A2E;

    --color-success: #4E6E53;
    --color-success-light: #8CAF92;
    --color-warning: #f59e0b;
    --color-warning-light: #fbbf24;
    --color-danger: #B33A3A;
    --color-danger-light: #D46B6B;
    --color-info: #3b82f6;
    --color-info-light: #60a5fa;

    /* Neutral Palette */
    --color-bg-primary: #F7F4EF;
    --color-bg-secondary: #FAF8F5;
    --color-bg-tertiary: #F0EDE8;

    --color-text-primary: #2B1B17;
    --color-text-secondary: #6B6158;
    --color-text-tertiary: #9E958F;

    /* Shadows & Depth */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-colored: 0 10px 25px -5px rgba(199, 146, 62, 0.25);

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;

    /* Spacing Scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Typography Scale */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Scroll personalizado */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #F0EDE8;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #DDD9D2;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9E958F;
}

/* Animaciones personalizadas */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

@keyframes fadeInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* Cards con efectos modernos */
.dashboard-card {
    @apply bg-white rounded-xl border border-gray-100 p-6;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    backdrop-filter: blur(10px);
    background: linear-gradient(135deg, rgba(255, 253, 250, 0.98) 0%, rgba(250, 248, 245, 0.95) 100%);
}

.dashboard-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: var(--shadow-lg);
    border-color: rgba(199, 146, 62, 0.2);
}

.dashboard-card-premium {
    background: linear-gradient(135deg, rgba(255, 253, 250, 0.95) 0%, rgba(250, 248, 245, 0.9) 100%);
    border: 1px solid rgba(199, 146, 62, 0.1);
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(199, 146, 62, 0.05);
}

/* Métricas Modernas */
.metric-card {
    @apply dashboard-card;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--olon-accent), var(--olon-espresso));
    opacity: 0.8;
}

.metric-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(199, 146, 62, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.metric-value {
    @apply text-4xl font-extrabold mb-2;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--color-text-primary) 0%, var(--color-text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.metric-label {
    @apply text-sm font-semibold uppercase tracking-wide;
    color: var(--color-text-secondary);
    letter-spacing: 0.05em;
}

.metric-change {
    @apply text-xs font-bold inline-flex items-center gap-1 px-2.5 py-1 rounded-full mt-2;
    backdrop-filter: blur(8px);
}

.metric-change.positive {
    @apply text-green-700;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(110, 231, 183, 0.15) 100%);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.metric-change.negative {
    @apply text-red-700;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(248, 113, 113, 0.15) 100%);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Animación de conteo para métricas */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.metric-value {
    animation: countUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Estados de loading */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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

    100% {
        background-position: -200% 0;
    }
}

/* Botones personalizados */
.btn-olon {
    @apply bg-gradient-to-r from-[#C7923E] to-[#2B1B17] text-white font-medium py-2 px-4 rounded-lg;
    @apply hover:from-[#A67A2E] hover:to-[#1E1210] transition-all duration-200;
    @apply focus:outline-none focus:ring-2 focus:ring-[#C7923E] focus:ring-opacity-50;
}

.btn-hanami:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(199, 146, 62, 0.4);
}

.btn-hanami-secondary {
    @apply border border-[#C7923E] text-[#C7923E] font-medium py-2 px-4 rounded-lg;
    @apply hover:bg-[#FBF5EC] transition-colors duration-200;
}

/* Alerts personalizadas */
.alert {
    @apply rounded-lg p-4 mb-4 border-l-4;
}

.alert-success {
    @apply bg-green-50 border-green-400 text-green-700;
}

.alert-warning {
    @apply bg-yellow-50 border-yellow-400 text-yellow-700;
}

.alert-error {
    @apply bg-red-50 border-red-400 text-red-700;
}

.alert-info {
    @apply bg-blue-50 border-blue-400 text-blue-700;
}

/* Sidebar personalizado */
.sidebar-nav a {
    position: relative;
}

.sidebar-nav a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--hanami-espresso);
    border-radius: 0 3px 3px 0;
}

/* Charts containers - Modernizados */
.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
    padding: var(--space-md);
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.4) 0%, rgba(255, 255, 255, 0.8) 100%);
    border-radius: var(--radius-lg);
}

.chart-header {
    @apply flex items-center justify-between mb-6;
}

.chart-title {
    @apply text-xl font-bold;
    color: var(--color-text-primary);
}

.chart-filters {
    @apply flex gap-2;
}

.chart-filter-btn {
    @apply px-4 py-2 text-sm font-medium rounded-lg transition-all;
    color: var(--color-text-secondary);
    background: transparent;
    border: 1px solid transparent;
}

.chart-filter-btn:hover {
    background: rgba(199, 146, 62, 0.08);
    color: var(--color-primary);
    border-color: rgba(199, 146, 62, 0.2);
}

.chart-filter-btn.active {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--olon-espresso) 100%);
    color: white;
    box-shadow: var(--shadow-colored);
}

/* Status indicators */
.status-dot {
    @apply inline-block w-2 h-2 rounded-full;
}

.status-dot.active {
    @apply bg-green-400;
    animation: pulse 2s infinite;
}

.status-dot.inactive {
    @apply bg-gray-400;
}

.status-dot.warning {
    @apply bg-yellow-400;
}

.status-dot.error {
    @apply bg-red-400;
}

/* Progress bars */
.progress-bar {
    @apply bg-gray-200 rounded-full h-2 overflow-hidden;
}

.progress-fill {
    @apply h-full bg-gradient-to-r from-[#C7923E] to-[#2B1B17] transition-all duration-500 ease-out;
}

/* Custom scrollable areas */
.custom-scroll {
    scrollbar-width: thin;
    scrollbar-color: #DDD9D2 #F0EDE8;
}

.custom-scroll::-webkit-scrollbar {
    width: 6px;
}

.custom-scroll::-webkit-scrollbar-track {
    background: #F0EDE8;
    border-radius: 3px;
}

.custom-scroll::-webkit-scrollbar-thumb {
    background: #DDD9D2;
    border-radius: 3px;
}

.custom-scroll::-webkit-scrollbar-thumb:hover {
    background: #9E958F;
}

/* Responsive adjustments - Optimizados */
@media (max-width: 1024px) {
    .dashboard-card {
        @apply p-5;
    }

    .metric-value {
        @apply text-3xl;
    }

    .chart-container {
        height: 280px;
    }

    .icon-container {
        width: 3rem;
        height: 3rem;
    }
}

@media (max-width: 640px) {
    .dashboard-card {
        @apply p-4;
    }

    .metric-value {
        @apply text-2xl;
    }

    .metric-label {
        @apply text-xs;
    }

    .chart-container {
        height: 220px;
    }

    .icon-container {
        width: 2.5rem;
        height: 2.5rem;
    }

    .chart-header {
        @apply flex-col items-start gap-3;
    }

    .chart-filters {
        @apply w-full flex justify-between;
    }
}

/* Dark mode support (futuro) */
@media (prefers-color-scheme: dark) {
    .dark .dashboard-card {
        @apply bg-gray-800 border-gray-700;
    }

    .dark .metric-value {
        @apply text-white;
    }

    .dark .metric-label {
        @apply text-gray-300;
    }
}

/* Form inputs */
.input-field {
    @apply block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm;
    @apply focus:outline-none focus:ring-2 focus:ring-[#C7923E] focus:border-[#C7923E];
    @apply placeholder-gray-400 text-gray-900 sm:text-sm;
}

.input-field:focus {
    @apply ring-[#C7923E] border-[#C7923E];
}

.input-field.error {
    @apply border-red-300 text-red-900 placeholder-red-300;
    @apply focus:ring-red-500 focus:border-red-500;
}

/* Button styles */
.btn {
    @apply inline-flex items-center px-4 py-2 border font-medium rounded-md;
    @apply focus:outline-none focus:ring-2 focus:ring-offset-2;
    @apply transition-colors duration-200;
}

.btn-primary {
    @apply bg-[#C7923E] border-transparent text-white;
    @apply hover:bg-[#A67A2E] focus:ring-[#C7923E];
}

.btn-secondary {
    @apply bg-white border-gray-300 text-gray-700;
    @apply hover:bg-gray-50 focus:ring-indigo-500;
}

.btn-success {
    @apply bg-green-600 border-transparent text-white;
    @apply hover:bg-green-700 focus:ring-green-500;
}

.btn-danger {
    @apply bg-red-600 border-transparent text-white;
    @apply hover:bg-red-700 focus:ring-red-500;
}

.btn:disabled {
    @apply opacity-50 cursor-not-allowed;
}

/* Utility classes - Modernizadas */
.text-gradient {
    background: linear-gradient(135deg, var(--hanami-accent), var(--hanami-espresso));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-hanami {
    background: linear-gradient(135deg, var(--hanami-accent), var(--hanami-espresso));
}

.bg-gradient-subtle {
    background: linear-gradient(135deg, rgba(199, 146, 62, 0.05) 0%, rgba(43, 27, 23, 0.08) 100%);
}

.border-gradient {
    border-image: linear-gradient(135deg, var(--hanami-accent), var(--hanami-espresso)) 1;
}

/* Icon containers modernos */
.icon-container {
    @apply flex items-center justify-center rounded-2xl;
    width: 3.5rem;
    height: 3.5rem;
    position: relative;
    transition: all var(--transition-base);
}

.icon-container::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(135deg, currentColor, transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.metric-card:hover .icon-container::before {
    opacity: 0.3;
}

.icon-container.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(110, 231, 183, 0.15) 100%);
}

.icon-container.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(96, 165, 250, 0.15) 100%);
}

.icon-container.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(251, 191, 36, 0.15) 100%);
}

.icon-container.danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(248, 113, 113, 0.15) 100%);
}

/* Glassmorphism effect */
.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.08);
}

/* Skeleton loaders mejorados */
.skeleton {
    background: linear-gradient(90deg,
            rgba(240, 240, 240, 0.8) 0%,
            rgba(224, 224, 224, 0.9) 50%,
            rgba(240, 240, 240, 0.8) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

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

    100% {
        background-position: -200% 0;
    }
}

/* Focus styles for accessibility */
.focus-hanami:focus {
    @apply outline-none ring-2 ring-[#C7923E] ring-opacity-50;
}

/* Print styles */
@media print {

    .sidebar,
    .no-print {
        display: none !important;
    }

    .dashboard-card {
        @apply border border-gray-300 break-inside-avoid;
        box-shadow: none;
    }
}

/* ============================================
   SIDEBAR ACCESSIBILITY IMPROVEMENTS - 2025
   ============================================ */

/* Focus-visible styles for keyboard navigation (WCAG 2.1 AA compliant) */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--hanami-pink);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
    transition: outline var(--transition-fast);
}

/* Sidebar specific focus styles */
.sidebar-nav a:focus-visible,
.sidebar-nav button:focus-visible {
    outline: 2px solid var(--hanami-pink);
    outline-offset: -2px;
    z-index: 1;
}

/* Active state indicator for sidebar links */
.sidebar-nav a.active {
    position: relative;
}

.sidebar-nav a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--hanami-purple);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Smooth transitions for sidebar items */
.sidebar-nav a,
.sidebar-nav button {
    transition: all var(--transition-base);
}

/* Submenu animations */
.sidebar-submenu {
    transition: max-height var(--transition-base) ease-out,
        opacity var(--transition-base) ease-out,
        transform var(--transition-base) ease-out;
}

/* Enhanced hover state for better UX */
.sidebar-nav a:hover {
    transform: translateX(2px);
}

/* Mobile overlay improvements */
.sidebar-overlay {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Responsive focus ring sizing */
@media (max-width: 640px) {

    a:focus-visible,
    button:focus-visible {
        outline-width: 3px;
        outline-offset: 3px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {

    a:focus-visible,
    button:focus-visible {
        outline: 3px solid currentColor;
        outline-offset: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .sidebar-nav a:hover {
        transform: none;
    }
}

/* Skip to content link for screen readers */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--hanami-pink);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* ============================================
   END SIDEBAR ACCESSIBILITY IMPROVEMENTS
   ============================================ */