/* ========================================
   Global Styles - YapeAlerta Partner Panel
   ======================================== */

/* Tailwind CSS Custom Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease;
}

/* ========================================
   Sidebar Styles - Responsive Layout
   ======================================== */

/* Sidebar Base */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    background: linear-gradient(180deg, #ffffff 0%, #fafbff 100%);
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    z-index: 50;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar Desktop - Expandido */
.sidebar-expanded {
    width: 18rem; /* 288px / w-72 */
}

/* Sidebar Desktop - Colapsado */
.sidebar-collapsed {
    width: 4.5rem; /* 72px */
}

/* Sidebar Mobile - Cerrado (oculto por defecto) */
@media (max-width: 767px) {
    .sidebar-mobile-closed {
        transform: translateX(-100%);
    }
    
    .sidebar-mobile-open {
        transform: translateX(0);
        width: 18rem;
    }
}

/* Desktop: Mantener siempre visible */
@media (min-width: 768px) {
    .sidebar-mobile-closed,
    .sidebar-mobile-open {
        transform: translateX(0);
    }
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    min-height: 5rem;
}

.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 1.5rem 0.5rem;
}

/* Logo Container */
.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.logo-container:hover {
    transform: translateY(-1px);
}

.logo-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 6px rgba(139, 92, 246, 0.3);
}

/* Logo Bipe específico */
.logo-icon-bipe {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 0.5rem;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.logo-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.25rem;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

/* Logo text Bipe específico */
.logo-text-bipe {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    white-space: nowrap;
    letter-spacing: -0.025em;
}

/* Toggle Button */
.toggle-btn,
.expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    background: transparent;
    color: #6b7280;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn:hover,
.expand-btn:hover {
    background: #f3f4f6;
    color: #4f46e5;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-collapsed .sidebar-nav {
    padding: 1rem 0.5rem;
}

/* Scrollbar personalizado */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Nav Items */
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    color: #4b5563;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    position: relative;
    font-weight: 500;
    font-size: 0.875rem;
}

.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 0.75rem 0.5rem;
}

.nav-item:hover {
    background: #f3f4f6;
    color: #4f46e5;
}

.nav-item:hover .nav-icon {
    background: #eef2ff;
    color: #4f46e5;
}

/* Nav Item Active State */
.nav-item.active {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    color: #4f46e5;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.1);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 0 2px 2px 0;
}

.nav-item.active .nav-icon {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.3);
}

/* Nav Icon */
.nav-icon {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

/* Nav Text */
.nav-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s ease;
}

.sidebar-collapsed .nav-text {
    display: none;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: center;
}

/* Animaciones */
@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* Responsive adjustments */
@media (max-width: 767px) {
    .sidebar-mobile-open {
        animation: slideInFromLeft 0.3s ease;
    }
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: #2d3748;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.75rem;
}

h4 {
    font-size: 1.5rem;
}

h5 {
    font-size: 1.25rem;
}

h6 {
    font-size: 1rem;
}

h1:focus, h2:focus, h3:focus, h4:focus, h5:focus, h6:focus {
    outline: none;
}

p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #5568d3;
}

strong {
    font-weight: 600;
}

/* Form Validation */
.valid.modified:not([type=checkbox]) {
    outline: 2px solid #48bb78;
    outline-offset: 2px;
}

.invalid {
    outline: 2px solid #f56565;
    outline-offset: 2px;
}

.validation-message {
    color: #e53e3e;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: block;
}

/* Blazor Error UI */
#blazor-error-ui {
    color-scheme: light only;
    background: linear-gradient(135deg, #fee 0%, #fdd 100%);
    border-top: 3px solid #f56565;
    bottom: 0;
    box-shadow: 0 -4px 20px rgba(245, 101, 101, 0.3);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 1rem 3rem 1rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 10000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #c53030;
    font-size: 1.5rem;
    font-weight: bold;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

#blazor-error-ui .dismiss:hover {
    opacity: 1;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWd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Dg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, linear-gradient(135deg, #fed7d7 0%, #feb2b2 100%);
    padding: 1.5rem 1.5rem 1.5rem 4rem;
    color: #742a2a;
    border-radius: 12px;
    margin: 20px;
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.2);
}

.blazor-error-boundary::after {
    content: "Ha ocurrido un error en la aplicación.";
    font-weight: 600;
}

/* Loading Progress */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1.5rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #667eea;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 600;
    inset: calc(20vh + 3.5rem) 0 auto 0;
    color: #4a5568;
    font-size: 0.875rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Cargando...");
}

/* Code Elements */
code {
    color: #c53030;
    background: #fed7d7;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.875em;
    font-family: 'Courier New', Courier, monospace;
}

/* Form Floating */
.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: #a0aec0;
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* 404 Page */
.not-found-container {
    text-align: center;
    padding: 60px 20px;
}

.not-found-container h1 {
    font-size: 120px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
}

.not-found-container p {
    font-size: 18px;
    color: #718096;
    margin-bottom: 30px;
}

/* Responsive Typography */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    h4 {
        font-size: 1.25rem;
    }

    h5 {
        font-size: 1.1rem;
    }

    h6 {
        font-size: 1rem;
    }

    .not-found-container h1 {
        font-size: 80px;
    }

    .not-found-container p {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 13px;
    }

    .loading-progress {
        width: 6rem;
        height: 6rem;
    }

    .not-found-container h1 {
        font-size: 60px;
    }

    .not-found-container p {
        font-size: 14px;
    }

    #blazor-error-ui {
        padding: 0.875rem 2.5rem 0.875rem 1.25rem;
        font-size: 0.875rem;
    }
}