/* ===== VARIABLES GLOBALES ===== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1f2937;
    --gray: #6b7280;
    --light: #f3f4f6;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.2);
}

/* ===== RESET Y BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== HEADER RESPONSIVE ===== */
.app-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 10px 0;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.logo-img {
    height: 40px;
    width: auto;
    border-radius: 8px;
    border: 2px solid white;
}

.logo-text h1 {
    font-size: 1.2rem;
    color: var(--dark);
}

.logo-text p {
    font-size: 0.7rem;
    color: var(--gray);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--light);
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* ===== NAVBAR RESPONSIVE ===== */
.navbar {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 60px;
    z-index: 999;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.navbar::-webkit-scrollbar {
    display: none;
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    align-items: center;
    min-width: min-content;
}

.nav-links {
    display: flex;
    gap: 5px;
    padding: 8px 0;
}

.nav-links a {
    padding: 8px 15px;
    color: var(--gray);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 30px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.nav-links a i {
    font-size: 1rem;
}

.nav-links a:hover {
    background: var(--light);
    color: var(--primary);
}

.nav-links a.active {
    background: var(--primary);
    color: white;
}

.menu-toggle {
    display: none;
    font-size: 1.5rem;
    color: var(--gray);
    cursor: pointer;
    padding: 8px;
}

/* ===== CONTENEDOR PRINCIPAL ===== */
.main-content {
    flex: 1;
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

/* ===== TARJETAS ===== */
.card {
    background: white;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== BOTONES ===== */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 30px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    -webkit-appearance: none;
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

/* ===== FORMULARIOS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 14px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    -webkit-appearance: none;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

/* ===== GRID RESPONSIVE ===== */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

/* ===== TABLAS RESPONSIVE ===== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 15px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th {
    background: var(--primary);
    color: white;
    padding: 12px;
    font-weight: 500;
    text-align: left;
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
}

/* ===== ALERTAS ===== */
.alert {
    padding: 12px 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--secondary);
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

/* ===== MODAL RESPONSIVE ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 15px;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

/* ===== FOOTER ===== */
.app-footer {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    padding: 30px 0 20px;
    margin-top: 40px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.footer-col h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col ul li a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.social-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.social-links a {
    color: white;
    font-size: 1.5rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
}

/* ===== MEDIA QUERIES ===== */
@media (min-width: 640px) {
    .logo-img { height: 45px; }
    .logo-text h1 { font-size: 1.3rem; }
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
    .btn { width: auto; }
}

@media (min-width: 768px) {
    .navbar { top: 70px; }
    .nav-links a { padding: 10px 20px; }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .footer-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1024px) {
    .container { margin: 30px auto; }
    .card { padding: 30px; }
}

/* ===== UTILIDADES ===== */
.text-center { text-align: center; }
.mt-2 { margin-top: 20px; }
.mb-2 { margin-bottom: 20px; }
.hide-mobile { display: none; }

@media (min-width: 640px) {
    .hide-mobile { display: inline; }
}

/* ===== TOUCH OPTIMIZATIONS ===== */
button, 
.nav-links a,
.social-links a,
.file-btn,
.action-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* ===== ANIMACIONES ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}