/* Contract Support - Sistema de Gestión de Contratos */

/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}

body {
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    background: #f3f4f6;
    color: #111827;
    font-family: system-ui, -apple-system, sans-serif;
}

/* Colores por funcionalidad según la guía de diseño */
:root {
    /* Verde - Acciones de Creación */
    --color-create-primary: #059669;
    --color-create-hover: #047857;
    --color-create-light: #dcfce7;
    
    /* Morado - Exportación y Descarga */
    --color-export-primary: #9333ea;
    --color-export-hover: #7c3aed;
    --color-export-light: #ede9fe;
    
    /* Azul - Edición y Visualización */
    --color-edit-primary: #2563eb;
    --color-edit-hover: #1d4ed8;
    --color-edit-light: #dbeafe;
    
    /* Naranja - Navegación y Secundario */
    --color-nav-primary: #ea580c;
    --color-nav-hover: #c2410c;
    --color-nav-light: #fed7aa;
    
    /* Rojo - Alertas y Eliminación */
    --color-delete-primary: #ef4444;
    --color-delete-hover: #dc2626;
    --color-delete-dark: #991b1b;
    
    /* Gris - Acciones Neutras */
    --color-neutral-dark: #374151;
    --color-neutral-medium: #6b7280;
    --color-neutral-light: #f3f4f6;
    
    /* Estados */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #3b82f6;
    
    /* Texto */
    --color-text-primary: #111827;
    --color-text-secondary: #6b7280;
    --color-text-placeholder: #9ca3af;
}

/* Componentes Base - Botones */
.btn-base {
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.15s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-create {
    background: var(--color-create-primary);
    color: white;
}
.btn-create:hover {
    background: var(--color-create-hover);
}

.btn-export {
    background: var(--color-export-primary);
    color: white;
}
.btn-export:hover {
    background: var(--color-export-hover);
}

.btn-edit {
    background: var(--color-edit-primary);
    color: white;
}
.btn-edit:hover {
    background: var(--color-edit-hover);
}

.btn-nav {
    background: var(--color-nav-primary);
    color: white;
}
.btn-nav:hover {
    background: var(--color-nav-hover);
}

.btn-delete {
    background: var(--color-delete-primary);
    color: white;
}
.btn-delete:hover {
    background: var(--color-delete-hover);
}

.btn-neutral {
    background: var(--color-neutral-medium);
    color: white;
}
.btn-neutral:hover {
    background: var(--color-neutral-dark);
}

/* Botones Secundarios */
.btn-secondary {
    background: transparent;
    border: 1px solid currentColor;
    color: var(--color-text-secondary);
}

/* Tarjetas (Cards) */
.card-base {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    padding: 20px;
    transition: all 0.15s ease;
}

.card-base:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.card-metrics {
    border-radius: 12px;
    padding: 24px;
    background: linear-gradient(135deg, var(--color-neutral-light), #ffffff);
    border: 1px solid #e5e7eb;
}

/* Estados de Badges */
.badge-active {
    background: var(--color-create-light);
    color: #166534;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}

.badge-inactive {
    background: #fee2e2;
    color: var(--color-nav-dark);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}

.badge-info {
    background: var(--color-edit-light);
    color: #1e40af;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}

/* Animaciones y transiciones */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Overlay para modales */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

/* Pantallas de la aplicación */
.app-screen {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.app-screen.active {
    display: block;
}

/* Navegación */
.nav-btn {
    transition: all 0.15s ease;
    border: none;
    background: transparent;
    cursor: pointer;
}

.nav-btn:hover {
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 640px) {
    .modal-content {
        margin: 0;
        padding: 16px;
        border-radius: 0;
        height: 100vh;
        max-height: none;
    }
    
    .card-metrics {
        padding: 16px;
    }
    
    .btn-base {
        padding: 10px 16px;
        font-size: 13px;
    }
}

@media (min-width: 641px) {
    .app-container {
        border-radius: 20px;
        overflow: hidden;
    }
}
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-10px);
    }
    70% {
        transform: translateY(-5px);
    }
    90% {
        transform: translateY(-2px);
    }
}

/* Aplicar animaciones */
.app-screen.active {
    animation: slideIn 0.3s ease-out;
}

.world-card {
    transition: all 0.3s ease;
}

.world-card:hover {
    animation: pulse 0.6s ease-in-out;
}

.option-btn {
    transition: all 0.2s ease;
}

.option-btn:active {
    transform: translateY(1px);
}

/* Efectos visuales para elementos interactivos */
.nav-btn {
    transition: all 0.2s ease;
    position: relative;
}

.nav-btn:active {
    transform: scale(0.95);
}

.nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background-color: #f97316;
    border-radius: 50%;
}

/* Efectos para botones principales */
.btn-primary {
    background: #ea580c;
    transition: all 0.3s ease;
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(234, 88, 12, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.3);
}

/* Efectos para las barras de progreso */
.progress-bar {
    background: #10b981;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Efectos para las estadísticas */
.stat-card {
    transition: all 0.3s ease;
    background: #374151;
    border: 1px solid rgba(75, 85, 99, 0.3);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    border-color: #ea580c;
}

/* Efectos para insignias y logros */
.badge {
    position: relative;
    overflow: hidden;
}

.badge::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(transparent, rgba(255,255,255,0.3), transparent);
    animation: rotate 3s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.badge:hover::before {
    opacity: 1;
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Efectos para overlays */
.overlay {
    backdrop-filter: blur(10px);
    background: rgba(0,0,0,0.6);
    animation: fadeIn 0.3s ease;
}

.overlay .modal {
    animation: bounce 0.5s ease;
}

/* Efectos para elementos de respuesta */
.correct-answer {
    background: #059669;
    color: white;
    border-color: #059669 !important;
    animation: bounce 0.6s ease;
}

.wrong-answer {
    background: #dc2626;
    color: white;
    border-color: #dc2626 !important;
    animation: shake 0.6s ease;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Efectos para elementos de carga */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #f97316;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Efectos para elementos de notificación */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #059669;
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(5, 150, 105, 0.3);
    animation: slideInRight 0.5s ease, fadeOut 0.5s ease 2.5s forwards;
    z-index: 1000;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Responsive adjustments */
@media (max-width: 375px) {
    .world-card {
        margin: 0;
    }
    
    .grid-cols-3 {
        gap: 8px;
    }
    
    .text-2xl {
        font-size: 1.4rem;
    }
    
    .app-container {
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
    }
    
    body {
        margin: 0 !important;
        padding: 0 !important;
        width: 100vw !important;
        overflow-x: hidden !important;
    }
}

/* Para tablets y pantallas medianas */
@media (min-width: 376px) and (max-width: 768px) {
    body {
        padding: 20px 0;
    }
    
    .app-container {
        border-radius: 20px;
        overflow: hidden;
    }
}

/* Para desktop */
@media (min-width: 769px) {
    body {
        padding: 40px 20px;
        background: #111827;
    }
    
    .app-container {
        border-radius: 24px;
        overflow: hidden;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    }
}

/* Dark mode support (now default) */
.stat-card {
    background: #374151;
    color: white;
}

/* Accessibility improvements */
.focus-visible {
    outline: 2px solid #f97316;
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .world-card,
    .stat-card,
    .option-btn {
        border-width: 2px;
        border-color: #000;
    }
}

/* 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;
    }
}
