/* Estilos para la página de mis pedidos */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    line-height: 1.6;
    overflow-x: hidden; /* Evitar scroll horizontal */
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none; /* Hidden by default, shown in media query */
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    cursor: pointer;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hamburger {
    width: 24px;
    height: 18px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Mobile Sidebar Overlay */
.mobile-sidebar-overlay {
    display: none; /* Hidden by default, shown by JS */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-sidebar-overlay.active {
    opacity: 1;
}

.main-container {
    display: flex;
    min-height: 100vh;
    max-width: 100vw; /* Evitar overflow horizontal */
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0; /* No reducir tamaño */
}

.logo {
    display: flex;
    align-items: center;
    padding: 0 20px 30px;
    border-bottom: 1px solid #475569;
    margin-bottom: 20px;
}

.logo-image {
    width: 32px;
    height: 32px;
    margin-right: 12px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: #f8fafc;
}

.nav-menu {
    padding: 0 20px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

.nav-item i {
    width: 20px;
    margin-right: 12px;
    font-size: 16px;
}

.check-icon {
    position: absolute;
    right: 16px;
    color: #10b981;
    font-size: 14px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 20px;
    max-width: calc(100vw - 280px); /* Evitar overflow */
    overflow-x: hidden; /* Evitar scroll horizontal */
}

/* Header */
.top-header {
    background: white;
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Permitir wrap en pantallas pequeñas */
    gap: 15px;
}

.header-left h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-right {
    display: flex;
    gap: 12px;
    flex-wrap: wrap; /* Permitir wrap */
}

.btn-admin, .btn-account, .btn-logout {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
    white-space: nowrap; /* Evitar que se rompa el texto */
}

.btn-admin {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-admin:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.btn-account {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
}

.btn-account:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(96, 165, 250, 0.4);
}

.btn-logout {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-logout:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

/* Filters Section */
.filters-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-tab {
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    white-space: nowrap;
}

.filter-tab:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.filter-tab.active {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-color: #3b82f6;
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.search-section {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap; /* Permitir wrap */
}

.search-container {
    position: relative;
    flex: 1;
    min-width: 200px; /* Ancho mínimo */
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 16px;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-refresh {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-refresh:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(96, 165, 250, 0.4);
}

/* Orders Section */
.orders-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.orders-table {
    width: 100%;
    overflow-x: auto; /* Scroll horizontal solo cuando sea necesario */
}

.table-header {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    display: grid;
    grid-template-columns: 80px 1fr 120px 100px 100px 120px 150px 1fr;
    gap: 1px;
    padding: 0;
    min-width: 1000px; /* Ancho mínimo para evitar compresión excesiva */
}

.header-cell {
    padding: 16px 12px;
    font-weight: 600;
    font-size: 14px;
    text-align: left;
}

.table-content {
    max-height: 600px;
    overflow-y: auto;
}

.order-row {
    display: grid;
    grid-template-columns: 80px 1fr 120px 100px 100px 120px 150px 1fr;
    gap: 1px;
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.3s ease;
    min-width: 1000px; /* Mismo ancho mínimo */
}

.order-row:hover {
    background-color: #f8fafc;
}

.order-cell {
    padding: 16px 12px;
    font-size: 14px;
    display: flex;
    align-items: center;
}

.order-id {
    font-weight: 700;
    color: #3b82f6;
}

.order-service {
    color: #475569;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-category {
    color: #64748b;
    font-size: 13px;
}

.order-quantity {
    font-weight: 600;
    color: #1e293b;
}

.order-price {
    font-weight: 700;
    color: #059669;
}

.order-status {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    text-align: center;
    min-width: 80px;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-processing {
    background: #dbeafe;
    color: #1e40af;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.status-partial {
    background: #fef3c7;
    color: #92400e;
}

.status-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.status-failed {
    background: #fecaca;
    color: #dc2626;
}

.order-date {
    color: #64748b;
    font-size: 13px;
}

/* Estilos para la columna de enlaces */
.order-link {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.order-link a {
    color: #3b82f6;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.3s ease;
    display: block;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.order-link a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.order-link a:visited {
    color: #7c3aed;
}

.btn-copy {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.btn-copy:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
    transform: scale(1.05);
}

.btn-copy i {
    font-size: 12px;
    color: #6b7280;
    transition: color 0.3s ease;
}

.btn-copy:hover i {
    color: white;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    gap: 16px;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap; /* Permitir wrap */
}

.pagination button {
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
}

.pagination button:hover:not(:disabled) {
    border-color: #3b82f6;
    color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-size: 14px;
    color: #64748b;
    font-weight: 600;
}

/* States */
.no-orders, .loading {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.no-orders i, .loading i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #3b82f6;
}

.no-orders h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: #1e293b;
}

.no-orders p {
    font-size: 14px;
    color: #64748b;
}

/* Animaciones para notificaciones */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Responsive Design Mejorado para Mis Pedidos */

/* Pantallas grandes */
@media (max-width: 1200px) {
    .main-content {
        margin-left: 250px;
        padding: 15px;
        max-width: calc(100vw - 250px);
    }
    
    .sidebar {
        width: 250px;
    }
    
    .table-header, .order-row {
        grid-template-columns: 80px 1fr 100px 80px 80px 100px 120px 1fr;
        min-width: 900px;
    }
    
    .order-service {
        max-width: 130px;
    }
    
    .order-link {
        max-width: 180px;
    }
    
    .btn-copy {
        min-width: 20px;
        height: 20px;
        padding: 3px 4px;
    }
    
    .btn-copy i {
        font-size: 10px;
    }
}

/* Tablets y pantallas medianas */
@media (max-width: 1024px) {
    .main-content {
        margin-left: 250px;
        padding: 15px;
        max-width: calc(100vw - 250px);
    }
    
    .top-header {
        padding: 15px 20px;
    }
    
    .header-left h1 {
        font-size: 20px;
    }
    
    .table-header, .order-row {
        grid-template-columns: 70px 1fr 80px 70px 70px 90px 100px 1fr;
        min-width: 800px;
    }
    
    .order-service {
        max-width: 100px;
    }
    
    .order-link {
        max-width: 130px;
    }
}

/* Móviles y tablets pequeñas */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    .sidebar {
        width: 280px;
        height: 100vh;
        position: fixed;
        top: 0;
        left: -280px;
        z-index: 1001;
        transition: left 0.3s ease;
        background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
        padding: 20px 0;
        overflow-y: auto;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }

    .sidebar.active {
        left: 0;
    }
    
    .main-container {
        flex-direction: column;
    }
    
    .main-content {
        margin-left: 0;
        padding: 15px;
        padding-top: 80px; /* Space for hamburger */
        max-width: 100vw;
    }
    
    .top-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px;
        margin-top: 20px;
    }
    
    .header-left h1 {
        font-size: 18px;
        justify-content: center;
    }
    
    .header-right {
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .btn-admin, .btn-account, .btn-logout {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .filter-tabs {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .filter-tab {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .search-section {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-container {
        width: 100%;
    }
    
    .search-input {
        width: 100%;
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .btn-refresh {
        padding: 10px 12px;
        font-size: 13px;
        width: 100%;
        justify-content: center;
    }
    
    /* Tabla responsive para móviles - Diseño de tarjetas */
    .orders-table {
        overflow-x: visible; /* Quitar scroll horizontal */
    }
    
    .table-header {
        display: none; /* Ocultar header en móvil */
    }
    
    .order-row {
        display: block; /* tarjeta */
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        margin-bottom: 15px;
        padding: 15px;
        background: white;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        min-width: auto;
    }

    .order-cell {
        display: grid;
        grid-template-columns: 90px 1fr; /* etiqueta | valor */
        align-items: start;
        column-gap: 12px;
        padding: 8px 0;
        border-bottom: 1px solid #f1f5f9;
        font-size: 14px;
    }

    .order-cell:last-child { border-bottom: none; }

    /* Mostrar etiqueta como en todas las filas */
    .order-cell::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
    }

    /* Poner el valor de Servicio en la segunda columna (separado del label) */
    .order-service { grid-column: auto; }
    .order-service { grid-column: 1 / -1; }
    .order-service::before { grid-column: 1 / 2; }
    .order-service { display: grid; grid-template-columns: 90px 1fr; column-gap: 12px; }
    .order-service .cell-value { grid-column: 2 / 3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    /* Enlace con formato tipo Fecha: permitir varias líneas sin corte */
    .order-cell[data-label="Enlace"] { align-items: start; }
    .link-container { display: block; width: 100%; }
    .order-link { min-width: 0; }
    .order-link a {
        display: block;
        white-space: normal;      /* varias líneas */
        overflow: visible;        /* no truncar */
        word-break: break-all;    /* URLs largas */
        cursor: pointer;
    }
}

/* Móviles pequeños */
@media (max-width: 480px) {
    .main-content {
        padding: 10px;
        padding-top: 70px;
    }
    
    .top-header {
        padding: 12px;
        gap: 12px;
    }
    
    .header-left h1 {
        font-size: 16px;
    }
    
    .header-right {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-admin, .btn-account, .btn-logout {
        width: 100%;
        justify-content: center;
        padding: 10px;
        font-size: 12px;
    }
    
    .filter-tabs {
        flex-direction: column;
        gap: 6px;
    }
    
    .filter-tab {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .search-section {
        gap: 8px;
    }
    
    .search-input {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .btn-refresh {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    /* Ajustes adicionales para móviles pequeños */
    .order-row {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .order-cell {
        padding: 6px 0;
        font-size: 13px;
    }
    
    .order-cell::before {
        min-width: 80px;
        font-size: 12px;
    }
    
    .order-id {
        font-size: 15px;
    }
    
    .order-service {
        font-size: 14px;
    }
    
    .order-price {
        font-size: 15px;
    }
    
    .order-status {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .order-date {
        font-size: 12px;
    }
    
    .order-link {
        font-size: 12px;
    }
    
    .btn-copy {
        min-width: 28px;
        height: 28px;
        padding: 4px;
    }
    
    .btn-copy i {
        font-size: 12px;
    }
}

/* Dispositivos muy pequeños */
@media (max-width: 360px) {
    .main-content {
        padding: 8px;
        padding-top: 60px;
    }
    
    .top-header {
        padding: 10px;
    }
    
    .header-left h1 {
        font-size: 14px;
    }
    
    .btn-admin, .btn-account, .btn-logout {
        padding: 8px 10px;
        font-size: 11px;
    }
    
    .filter-tab {
        padding: 5px 8px;
        font-size: 11px;
    }
    
    .search-input {
        padding: 6px 8px;
        font-size: 11px;
    }
    
    .btn-refresh {
        padding: 6px 8px;
        font-size: 11px;
    }
    
    .order-row {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .order-cell {
        padding: 4px 0;
        font-size: 12px;
    }
    
    .order-cell::before {
        min-width: 70px;
        font-size: 11px;
    }
    
    .order-id {
        font-size: 14px;
    }
    
    .order-service {
        font-size: 13px;
    }
    
    .order-price {
        font-size: 14px;
    }
    
    .order-status {
        padding: 3px 6px;
        font-size: 10px;
    }
    
    .order-date {
        font-size: 11px;
    }
    
    .order-link {
        font-size: 11px;
    }
    
    .btn-copy {
        min-width: 24px;
        height: 24px;
        padding: 3px;
    }
    
    .btn-copy i {
        font-size: 10px;
    }
}

/* Mejoras para accesibilidad táctil */
@media (max-width: 768px) {
    .nav-item,
    .btn-admin,
    .btn-account,
    .btn-logout,
    .filter-tab,
    .btn-refresh,
    .btn-copy {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .search-input {
        min-height: 44px;
        touch-action: manipulation;
    }
}

/* Mobile Menu Styles */
@media (max-width: 768px) {
    /* Mejorar la navegación móvil */
    .nav-item {
        padding: 16px 20px;
        margin-bottom: 4px;
        border-radius: 0;
        border-left: 4px solid transparent;
        transition: all 0.3s ease;
    }

    .nav-item:hover {
        background: rgba(255, 255, 255, 0.1);
        border-left-color: #3b82f6;
    }

    .nav-item.active {
        background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
        border-left-color: #60a5fa;
    }

    /* Logo mejorado para móvil */
    .logo {
        padding: 20px;
        margin-bottom: 30px;
        border-bottom: 1px solid #475569;
    }

    .logo-text {
        font-size: 22px;
    }
}
