/**
 * ESTILOS PRINCIPALES - GAMESTOP MEDELLÍN
 * Sistema de Gestión de Envíos
 */

/* ============================================
   RESET Y BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: var(--weight-regular);
    line-height: var(--line-normal);
    color: var(--primary-dark);
    background: var(--bg-secondary);
    overflow-x: hidden;
}

/* ============================================
   TIPOGRAFÍA
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-headings);
    font-weight: var(--weight-bold);
    line-height: var(--line-tight);
    color: var(--primary-dark);
    margin-bottom: var(--space-4);
}

h1 { font-size: var(--text-h1); font-weight: var(--weight-black); }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); }
h4 { font-size: var(--text-h4); }
h5 { font-size: var(--text-h5); }

p {
    margin-bottom: var(--space-4);
}

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

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-dark);
    color: var(--primary-white);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform var(--transition-base);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.header {
    background: var(--primary-white);
    height: var(--header-height);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    padding: 0 var(--space-6);
}

.content-wrapper {
    padding: var(--space-6);
    max-width: var(--container-2xl);
    margin: 0 auto;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar-header {
    padding: var(--space-6);
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    max-width: 180px;
    height: auto;
    margin-bottom: var(--space-4);
    background: var(--primary-white);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sidebar-title {
    color: var(--primary-white);
    font-size: var(--text-h5);
    font-weight: var(--weight-semibold);
    margin: 0;
}

.sidebar-nav {
    padding: var(--space-4) 0;
}

.nav-item {
    margin-bottom: var(--space-2);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    color: var(--light-gray);
    font-weight: var(--weight-medium);
    transition: all var(--transition-base);
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary-white);
    border-left-color: var(--primary-red);
}

.nav-link.active {
    background: rgba(227, 25, 55, 0.1);
    color: var(--primary-white);
    border-left-color: var(--primary-red);
    font-weight: var(--weight-semibold);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ============================================
   HEADER
   ============================================ */
.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.header-title {
    font-size: var(--text-h3);
    font-weight: var(--weight-bold);
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--primary-red);
    color: var(--primary-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--weight-bold);
}

/* ============================================
   BOTONES
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0.875rem 2rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-red);
    color: var(--primary-white);
}

.btn-primary:hover {
    background: var(--primary-red-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-red);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-dark);
    border: 2px solid var(--primary-dark);
}

.btn-secondary:hover {
    background: var(--primary-dark);
    color: var(--primary-white);
}

.btn-success {
    background: var(--success);
    color: var(--primary-white);
}

.btn-success:hover {
    background: #27ae60;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--error);
    color: var(--primary-white);
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: var(--text-sm);
}

.btn-lg {
    padding: 1rem 2.5rem;
    font-size: var(--text-cta);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   TARJETAS
   ============================================ */
.card {
    background: var(--primary-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    padding: var(--space-5);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 2px solid var(--light-gray);
}

.card-title {
    font-size: var(--text-h4);
    font-weight: var(--weight-bold);
    margin: 0;
}

.card-body {
    padding: var(--space-2) 0;
}

.card-footer {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--light-gray);
}

/* ============================================
   FORMULARIOS
   ============================================ */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-2);
    color: var(--primary-dark);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--light-gray);
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: var(--text-base);
    transition: all var(--transition-fast);
    background: var(--primary-white);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: var(--shadow-focus);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-error {
    color: var(--error);
    font-size: var(--text-sm);
    margin-top: var(--space-2);
}

/* ============================================
   TABLAS
   ============================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
}

.table {
    width: 100%;
    background: var(--primary-white);
    border-collapse: collapse;
}

.table thead {
    background: var(--bg-dark);
    color: var(--primary-white);
}

.table th {
    padding: var(--space-4);
    text-align: left;
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    font-size: var(--text-sm);
    letter-spacing: var(--tracking-wide);
}

.table td {
    padding: var(--space-4);
    border-bottom: 1px solid var(--light-gray);
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--bg-secondary);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-2xl);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
}

.badge-success { background: var(--success); color: var(--primary-white); }
.badge-warning { background: var(--warning); color: var(--primary-white); }
.badge-danger { background: var(--error); color: var(--primary-white); }
.badge-info { background: var(--info); color: var(--primary-white); }
.badge-primary { background: var(--primary-red); color: var(--primary-white); }
.badge-secondary { background: var(--medium-gray); color: var(--primary-white); }

/* ============================================
   STATS CARDS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--primary-white);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--card-shadow);
    transition: all var(--transition-base);
    border-left: 4px solid var(--primary-red);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--medium-gray);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    margin-bottom: var(--space-2);
}

.stat-value {
    font-size: var(--text-h2);
    font-weight: var(--weight-black);
    color: var(--primary-dark);
    font-family: var(--font-mono);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-3);
}

/* ============================================
   MODALES
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--primary-white);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-2xl);
    transform: scale(0.9);
    transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: var(--space-5);
    border-bottom: 2px solid var(--light-gray);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: var(--text-h4);
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 24px;
    color: var(--medium-gray);
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--primary-red);
}

.modal-body {
    padding: var(--space-5);
}

.modal-footer {
    padding: var(--space-5);
    border-top: 1px solid var(--light-gray);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: var(--z-toast);
    font-weight: var(--weight-semibold);
    max-width: 400px;
    opacity: 0;
    transform: translateX(400px);
    transition: all var(--transition-base);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--medium-gray); }
.text-danger { color: var(--error); }
.text-success { color: var(--success); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

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

    /* Optimizar header en tablets */
    .header {
        padding: 0 var(--space-4);
    }
}

@media (max-width: 768px) {
    /* Header */
    .header {
        padding: 0 var(--space-3);
        height: auto;
        min-height: var(--header-height);
    }

    .header-content {
        flex-wrap: wrap;
        gap: var(--space-3);
    }

    .header-title {
        font-size: var(--text-h5);
        flex: 1;
        min-width: 150px;
    }

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

    .user-info {
        padding: var(--space-2) var(--space-3);
    }

    .user-info > div {
        display: none;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
    }

    /* Content */
    .content-wrapper {
        padding: var(--space-4);
    }

    /* Cards */
    .card {
        padding: var(--space-4);
    }

    .card-header {
        flex-direction: column;
        gap: var(--space-3);
        align-items: flex-start;
    }

    /* Buttons */
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: var(--text-sm);
    }

    /* Tables */
    .table-container {
        font-size: var(--text-sm);
        -webkit-overflow-scrolling: touch;
    }

    .table th,
    .table td {
        padding: var(--space-3);
        white-space: nowrap;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    /* Modals */
    .modal {
        width: 95%;
        max-width: 95%;
        margin: var(--space-4);
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: var(--space-4);
    }

    /* Form Grids - Stack columns on mobile */
    .modal-body form > div[style*="grid-template-columns"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
    }

    /* Flex utilities */
    .flex-between {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }

    .flex-between > .flex {
        width: 100%;
    }

    .flex-between > button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .header-title {
        font-size: var(--text-base);
        font-weight: var(--weight-bold);
    }

    .content-wrapper {
        padding: var(--space-3);
    }

    .card {
        padding: var(--space-3);
    }

    .btn {
        padding: 0.625rem 1rem;
        font-size: var(--text-xs);
        letter-spacing: 0.025em;
    }

    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: var(--text-xs);
    }

    /* Hide button text, show only icons on very small screens */
    .btn i + span {
        display: none;
    }

    .btn i {
        margin: 0;
    }

    /* Toast notifications */
    .toast {
        right: 10px;
        top: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
    }

    /* User info - show only avatar */
    .user-info {
        padding: var(--space-2);
    }

    /* Modal */
    .modal {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: var(--space-3);
    }

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

    /* Stats */
    .stat-value {
        font-size: var(--text-h3);
    }

    .stat-icon {
        width: 40px;
        height: 40px;
    }

    .stat-icon i {
        font-size: 1.5rem !important;
    }
}

/* ============================================
   ANIMACIONES
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.fade-in {
    animation: fadeIn var(--duration-base) ease;
}

.slide-up {
    animation: slideUp var(--duration-base) ease;
}
