/**
 * Estilos Principales del Sistema
 * Sistema de Gestión de Solicitudes de Recambios
 * Diseño Navy Blue - Mobile First
 */

/* ============================================
   Variables CSS
   ============================================ */

:root {
    /* Colores Corporativos - Deep Cerulean */
    --deep-cerulean: #007BA7;
    --deep-cerulean-dark: #005f85;
    --deep-cerulean-light: #00b0f0;
    --deep-cerulean-pale: #e6f7ff;

    /* Estados */
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --info: #3B82F6;
    --info-light: #DBEAFE;

    /* Neutrales */
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;

    /* Tipografía */
    --font-family: 'Aptos', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;

    /* Tamaños de fuente */
    --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;

    /* Espaciado */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Bordes */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Transiciones */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scroll Restoration Anti-Ghosting */
.loading-scroll body {
    opacity: 0 !important;
    pointer-events: none;
}

.ready-scroll body {
    opacity: 1;
    transition: opacity 0.15s ease-in;
}

/* ============================================
   Reset y Base
   ============================================ */

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

body {
    font-family: var(--font-family);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--gray-900);
    background: linear-gradient(180deg, var(--gray-50) 0%, var(--gray-100) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Tipografía
   ============================================ */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
    color: var(--gray-900);
}

h1 {
    font-size: var(--text-3xl);
}

h2 {
    font-size: var(--text-2xl);
}

h3 {
    font-size: var(--text-xl);
}

h4 {
    font-size: var(--text-lg);
}

h5 {
    font-size: var(--text-base);
}

h6 {
    font-size: var(--text-sm);
}

p {
    margin-bottom: var(--spacing-md);
}

a {
    color: var(--deep-cerulean);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--deep-cerulean-dark);
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--gray-100);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
}

/* ============================================
   Layout
   ============================================ */

.container {
    width: 100%;
    margin: 0 auto;
    padding: var(--spacing-md);
}

@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 960px;
        padding: var(--spacing-lg);
    }
}

@media (max-width: 1024px) {
    .container {
        padding: var(--spacing-sm);
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: 1200px;
    }
}

/* Grid System */
.grid {
    display: grid;
    gap: var(--spacing-md);
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Flexbox Utilities */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-sm {
    gap: var(--spacing-sm);
}

.gap-md {
    gap: var(--spacing-md);
}

.gap-lg {
    gap: var(--spacing-lg);
}

/* Visibility Utilities */
@media (max-width: 767px) {
    .hidden-mobile {
        display: none !important;
    }
}

/* ============================================
   Navegación Premium SGR
   ============================================ */

.navbar {
    background: #005f85;
    /* Fallback */
    background: linear-gradient(90deg, #005f85 0%, #007BA7 50%, #005f85 100%);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: white !important;
    text-decoration: none;
    letter-spacing: 0.05em;
}

/* SGR Toggle Button */
.sgr-toggle {
    display: none !important;
    /* Hidden on desktop */
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 0;
    cursor: pointer;
    width: 44px;
    height: 38px;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1002;
    outline: none;
}

/* Standardize size with avatar */
.navbar-quick-actions .btn-notification {
    background: transparent !important;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0;
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.navbar-quick-actions .btn-notification:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #EF4444;
    /* Standard Red for better visibility against blue */
    color: white;
    border: 1px solid white;
    /* High contrast border */
    border-radius: 9999px;
    padding: 0px 4px;
    font-size: 0.65rem;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    line-height: 14px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.sgr-hamburger {
    display: block;
    width: 22px;
    height: 2px;
    background: white !important;
    position: relative;
    transition: all 0.3s;
}

.sgr-hamburger::before,
.sgr-hamburger::after {
    content: '' !important;
    position: absolute;
    width: 22px;
    height: 2px;
    background: white !important;
    left: 0;
    display: block !important;
    transition: all 0.3s;
}

.sgr-hamburger::before {
    top: -7px;
}

.sgr-hamburger::after {
    top: 7px;
}

.sgr-toggle.active .sgr-hamburger {
    background: transparent !important;
}

.sgr-toggle.active .sgr-hamburger::before {
    transform: rotate(45deg);
    top: 0;
}

.sgr-toggle.active .sgr-hamburger::after {
    transform: rotate(-45deg);
    top: 0;
}

/* User Profile & Avatar */
.sgr-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.4);
    transition: all 0.2s;
    overflow: hidden;
    position: relative;
}

.sgr-avatar:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.05);
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-grow: 1;
    justify-content: space-between;
    margin-left: 2rem;
}

.navbar-links {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.nav-link {
    color: rgba(255, 255, 255, 0.95) !important;
    font-weight: 500;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0;
    overflow: hidden;
    white-space: nowrap;
}

.nav-link:hover {
    color: white !important;
    background: rgba(255, 255, 255, 0.15) !important;
}

.nav-text {
    max-width: 0;
    display: inline-block;
    overflow: hidden;
    transition: max-width 0.3s ease, margin-left 0.3s ease;
    margin-left: 0;
    font-weight: 500;
    font-size: var(--text-base);
    font-family: var(--font-family);
}

@media (min-width: 768px) {

    .nav-link:hover .nav-text,
    .btn-notification:hover .nav-text,
    .dropdown:hover .nav-text {
        max-width: 150px;
        margin-left: 0.5rem;
    }
}

.btn-notification {
    display: flex !important;
    align-items: center;
    gap: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Desktop notification button - same size as avatar */
.navbar-user .btn-notification {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    font-size: 1.4rem;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: white;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.navbar-user .btn-notification:hover {
    background-color: rgba(255, 255, 255, 0.1);
    width: auto;
    border-radius: 20px;
    padding: 0 1rem;
    min-width: 40px;
}

/* Bell ring animation surprise */
@keyframes ring {
    0% {
        transform: rotate(0);
    }

    10% {
        transform: rotate(15deg);
    }

    20% {
        transform: rotate(-10deg);
    }

    30% {
        transform: rotate(5deg);
    }

    40% {
        transform: rotate(-5deg);
    }

    50% {
        transform: rotate(0);
    }

    100% {
        transform: rotate(0);
    }
}

.btn-notification:hover .bell-icon {
    display: inline-block;
    animation: ring 1s ease infinite;
}

@media (max-width: 767px) {
    .nav-text {
        max-width: none;
        margin-left: 0.5rem;
    }
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: white;
}

/* Mobile Visibility Rules */
@media (max-width: 768px) {
    .desktop-hidden {
        display: flex !important;
    }

    .hidden-mobile {
        display: none !important;
    }

    .navbar-menu {
        display: none;
        /* Mobile menu styling attached to active state or js toggle */
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #005f85 !important;
        flex-direction: column;
        align-items: stretch;
        padding: 1.5rem;
        margin: 0;
        gap: 1rem;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 999;
    }

    .navbar-brand-group {
        width: 100%;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    /* Ensure the quick actions + hamburger form a group on the right */
    .sgr-toggle {
        display: flex !important;
        margin-left: 0.5rem;
        /* Gap between icons and burger */
    }

    .navbar-quick-actions {
        margin-left: auto;
        /* Push everything to the right */
        display: flex;
        gap: 0.5rem;
        align-items: center;
    }

    .navbar-menu.active {
        display: flex !important;
        animation: sgrSlide 0.3s ease-out;
    }

    .navbar-links {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .nav-link {
        width: 100%;
        background: rgba(255, 255, 255, 0.05) !important;
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: white !important;
    }

    .navbar-user {
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        padding-top: 1.25rem;
        width: 100%;
        justify-content: flex-start;
        gap: 1rem;
    }
}

/* Desktop Visibility Rules */
@media (min-width: 769px) {
    .desktop-hidden {
        display: none !important;
    }

    .hidden-mobile {
        display: flex !important;
    }

    .navbar-brand-group {
        width: auto;
        justify-content: flex-start;
        display: flex !important;
        align-items: center !important;
    }
}


@keyframes sgrSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

/* ============================================
   Contenido Principal
   ============================================ */

.main-content {
    min-height: calc(100vh - 120px);
    padding: var(--spacing-xl) 0;
}

.page-header {
    margin-bottom: var(--spacing-xl);
}

.page-header .flex {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-md);
}

@media (min-width: 768px) {
    .page-header .flex {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.page-title {
    font-size: var(--text-2xl);
    color: var(--gray-900);
    margin-bottom: var(--spacing-xs);
}

@media (min-width: 768px) {
    .page-title {
        font-size: var(--text-3xl);
        margin-bottom: var(--spacing-sm);
    }
}

.page-subtitle {
    color: var(--gray-600);
    font-size: var(--text-lg);
}

/* ============================================
   Utilidades de Espaciado
   ============================================ */

.mt-sm {
    margin-top: var(--spacing-sm);
}

.mt-md {
    margin-top: var(--spacing-md);
}

.mt-lg {
    margin-top: var(--spacing-lg);
}

.mt-xl {
    margin-top: var(--spacing-xl);
}

.mb-sm {
    margin-bottom: var(--spacing-sm);
}

.mb-md {
    margin-bottom: var(--spacing-md);
}

.mb-lg {
    margin-bottom: var(--spacing-lg);
}

.mb-xl {
    margin-bottom: var(--spacing-xl);
}

.p-sm {
    padding: var(--spacing-sm);
}

.p-md {
    padding: var(--spacing-md);
}

.p-lg {
    padding: var(--spacing-lg);
}

.p-xl {
    padding: var(--spacing-xl);
}

/* ============================================
   Utilidades de Texto
   ============================================ */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.text-sm {
    font-size: var(--text-sm);
}

.text-base {
    font-size: var(--text-base);
}

.text-lg {
    font-size: var(--text-lg);
}

.text-xl {
    font-size: var(--text-xl);
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.font-medium {
    font-weight: 500;
}

.text-gray {
    color: var(--gray-600);
}

.text-primary {
    color: var(--deep-cerulean);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

/* ============================================
   Utilidades Generales
   ============================================ */

.hidden {
    display: none !important;
}

.block {
    display: block;
}

.inline-block {
    display: inline-block;
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

/* ============================================
   Correcciones de Legibilidad y Dropdown v2
   ============================================ */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    background-color: #007BA7;
    min-width: 220px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    top: calc(100% + 5px);
    left: 0;
    border-radius: 10px;
    padding: 0.5rem 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.nav-dropdown-content.show {
    display: block !important;
}

.nav-dropdown-content a {
    color: white !important;
    padding: 0.8rem 1.2rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 14px;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-dropdown-content a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    padding-left: 1.2rem;
}

.dropdown-header {
    padding: 0.8rem 1.2rem 0.4rem 1.2rem;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.1em;
}

.dropdown-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 0.5rem 0;
}

/* Two-column admin menu layout - solo cuando no hay espacio vertical */
.nav-dropdown-wide {
    min-width: 220px;
}

.dropdown-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.dropdown-column {
    min-width: 0;
}

.dropdown-column .icon {
    display: inline-block;
    width: 1.5rem;
    text-align: center;
}

/* Dos columnas SOLO cuando hay poco espacio vertical (móviles en landscape o pantallas pequeñas) */
@media (max-height: 600px),
(max-width: 768px) and (max-height: 800px) {
    .dropdown-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        padding: 0.5rem;
    }

    .nav-dropdown-wide {
        min-width: 480px;
    }
}

/* Fix mobile legibility */
@media (max-width: 768px) {
    .nav-dropdown-content {
        position: static;
        display: none !important;
        width: 100%;
        box-shadow: none;
        background-color: rgba(0, 0, 0, 0.15);
        border: 1px solid rgba(255, 255, 255, 0.1);
        margin-top: 5px;
        backdrop-filter: none;
    }

    .nav-dropdown-content.show {
        display: block !important;
    }

    .nav-dropdown-wide {
        min-width: 100%;
    }
}