/* Variables de colores */
:root {
    --primary-color: #d35400; /* Naranja oscuro */
    --primary-dark: #a84300;
    --primary-light: #e67e22;
    --secondary-color: #2c3e50;
    --light-color: #ffffff;
    --light-bg: #f8f9fa;
    --border-color: #e0e0e0;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --gray-light: #ecf0f1;
    --gray-medium: #bdc3c7;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.15);
    --radius: 10px;
    --radius-sm: 5px;
    --transition: all 0.3s ease;
}

/* Estilos generales */
.establecimiento-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.establecimiento-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--light-color);
    padding: 25px 20px;
    border-radius: var(--radius);
    margin-bottom: 25px;
    text-align: center;
    box-shadow: var(--shadow);
}

.establecimiento-header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.establecimiento-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    margin-top: 10px;
    margin-bottom: 0;
}

.establecimiento-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

/* Cards */
.establecimiento-card {
    background: var(--light-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    height: 100%;
}

.establecimiento-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-5px);
}

.card-header {
    background: var(--secondary-color);
    color: var(--light-color);
    padding: 18px 25px;
    border-bottom: 3px solid var(--primary-color);
}

.card-header h2 {
    margin: 0;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 25px;
}

/* Formulario */
.establecimiento-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--light-bg);
    color: var(--secondary-color);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--light-color);
    box-shadow: 0 0 0 3px rgba(211, 84, 0, 0.1);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.input-with-icon {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    font-size: 1rem;
}

.input-with-icon .form-control {
    padding-left: 45px;
}

/* File Upload */
.file-upload-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

.file-upload {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: var(--light-bg);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--secondary-color);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    flex-direction: column;
}

.file-upload-label:hover {
    border-color: var(--primary-color);
    background: rgba(211, 84, 0, 0.05);
}

.file-upload-label i {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.file-upload-label span {
    font-size: 0.95rem;
}

/* Servicios - Mejorado */
.services-section {
    margin-top: 25px;
    background: var(--light-bg);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.services-title {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(211, 84, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.service-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--light-color);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    height: 70px;
    min-height: 70px;
}

.service-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(211, 84, 0, 0.1);
    transform: translateY(-2px);
}

.service-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--light-color);
    flex-shrink: 0;
    font-size: 1rem;
}

.service-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.service-name {
    font-size: 0.85rem;
    color: var(--secondary-color);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.service-select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--light-color);
    color: var(--secondary-color);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    height: 32px;
    max-width: 100%;
}

.service-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(211, 84, 0, 0.1);
}

/* Botones */
.btn-submit {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--light-color);
    border: none;
    padding: 15px 25px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    width: 100%;
}

.btn-submit:hover {
    background: linear-gradient(135deg, var(--primary-dark), #943800);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(211, 84, 0, 0.3);
}

.btn-submit:active {
    transform: translateY(0);
}

/* Búsqueda */
.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-refresh {
    background: var(--primary-color);
    color: var(--light-color);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-refresh:hover {
    background: var(--primary-dark);
    transform: rotate(180deg);
}

/* Tabla */
.establecimientos-table-container {
    background: var(--light-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.establecimientos-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--secondary-color);
    min-width: 600px;
}

.establecimientos-table thead {
    background: var(--primary-color);
    color: var(--light-color);
}

.establecimientos-table th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 3px solid var(--primary-dark);
    white-space: nowrap;
}

.establecimientos-table th i {
    margin-right: 8px;
}

.establecimientos-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.establecimientos-table tbody tr:hover {
    background: rgba(211, 84, 0, 0.05);
}

.establecimientos-table td {
    padding: 15px 12px;
    vertical-align: middle;
}

.establecimiento-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.establecimiento-thumb {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}

.thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.establecimiento-lugar {
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 0.95rem;
}

.establecimiento-nombre {
    font-weight: 500;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.establecimiento-precio {
    font-weight: 700;
    color: var(--success-color);
    font-size: 1rem;
}

.establecimiento-fecha {
    color: var(--gray-medium);
    font-size: 0.85rem;
}

/* Acciones */
.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-action {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-view {
    background: var(--success-color);
    color: var(--light-color);
}

.btn-view:hover {
    background: #219a52;
    transform: scale(1.1);
}

.btn-delete {
    background: var(--danger-color);
    color: var(--light-color);
}

.btn-delete:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* Estados */
.loading-spinner {
    text-align: center;
    padding: 40px 20px;
    color: var(--primary-color);
    font-size: 1rem;
}

.loading-spinner i {
    margin-right: 10px;
    font-size: 1.2rem;
}

.no-establecimientos {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-medium);
}

.no-establecimientos i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: var(--border-color);
}

.no-establecimientos p {
    font-size: 1rem;
    margin-bottom: 10px;
}

.search-suggestion {
    font-size: 0.9rem !important;
    opacity: 0.8;
}

.establecimiento-login-required {
    text-align: center;
    padding: 40px 20px;
    background: var(--light-bg);
    border-radius: var(--radius);
    color: var(--danger-color);
    font-size: 1.1rem;
}

.establecimiento-login-required i {
    font-size: 2rem;
    margin-bottom: 15px;
    display: block;
}

/* ============================ */
/* RESPONSIVE PARA CELULAR */
/* ============================ */

/* Tablets (768px - 1024px) */
@media (max-width: 1024px) {
    .establecimiento-row {
        gap: 20px;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .services-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 10px;
    }
    
    .service-item {
        padding: 10px;
        height: 65px;
        min-height: 65px;
    }
    
    .service-icon {
        width: 35px;
        height: 35px;
    }
}

/* Tablets pequeñas y móviles grandes (600px - 768px) */
@media (max-width: 768px) {
    .establecimiento-container {
        padding: 15px;
    }
    
    .establecimiento-header {
        padding: 20px 15px;
    }
    
    .establecimiento-header h1 {
        font-size: 1.7rem;
        gap: 10px;
        flex-direction: row;
    }
    
    .establecimiento-row {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .card-header {
        padding: 15px 20px;
    }
    
    .card-header h2 {
        font-size: 1.2rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    
    .service-item {
        height: 60px;
        min-height: 60px;
    }
    
    .service-icon {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    
    .service-name {
        font-size: 0.8rem;
    }
    
    .service-select {
        font-size: 0.8rem;
        height: 30px;
    }
    
    .search-container {
        flex-direction: column;
    }
    
    .btn-refresh {
        width: 100%;
        height: 45px;
    }
    
    .establecimientos-table th,
    .establecimientos-table td {
        padding: 12px 10px;
    }
}

/* Móviles medianos (480px - 600px) */
@media (max-width: 600px) {
    .establecimiento-container {
        padding: 10px;
    }
    
    .establecimiento-header h1 {
        font-size: 1.5rem;
        flex-direction: column;
        text-align: center;
    }
    
    .establecimiento-header h1 i {
        margin-bottom: 5px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .form-label {
        font-size: 0.9rem;
    }
    
    .form-control {
        padding: 10px 12px;
        font-size: 0.95rem;
    }
    
    .input-icon {
        left: 12px;
        font-size: 0.9rem;
    }
    
    .input-with-icon .form-control {
        padding-left: 40px;
    }
    
    .services-section {
        padding: 15px;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .service-item {
        flex-direction: column;
        height: auto;
        padding: 12px 8px;
        text-align: center;
        min-height: 90px;
    }
    
    .service-content {
        width: 100%;
        align-items: center;
    }
    
    .service-icon {
        margin-bottom: 8px;
        width: 40px;
        height: 40px;
    }
    
    .service-name {
        font-size: 0.8rem;
        margin-bottom: 4px;
        white-space: normal;
        line-height: 1.1;
        height: auto;
        overflow: visible;
        text-overflow: clip;
    }
    
    .service-select {
        width: 100%;
        max-width: 120px;
        font-size: 0.8rem;
        padding: 5px 8px;
    }
    
    .btn-submit {
        padding: 14px 20px;
        font-size: 0.95rem;
    }
    
    /* Tabla responsive para móviles */
    .establecimientos-table {
        min-width: 100%;
        display: block;
    }
    
    .establecimientos-table thead {
        display: none;
    }
    
    .establecimientos-table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        padding: 15px;
    }
    
    .establecimientos-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid var(--light-bg);
    }
    
    .establecimientos-table td:last-child {
        border-bottom: none;
    }
    
    .establecimientos-table td:before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--primary-color);
        margin-right: 10px;
        font-size: 0.85rem;
        min-width: 70px;
    }
    
    .establecimiento-info {
        justify-content: space-between;
        width: 100%;
    }
    
    .table-actions {
        justify-content: flex-end;
        width: 100%;
    }
}

/* Móviles pequeños (hasta 480px) */
@media (max-width: 480px) {
    .establecimiento-header {
        padding: 15px 10px;
    }
    
    .establecimiento-header h1 {
        font-size: 1.3rem;
    }
    
    .establecimiento-subtitle {
        font-size: 0.9rem;
    }
    
    .card-header {
        padding: 12px 15px;
    }
    
    .card-header h2 {
        font-size: 1.1rem;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .service-item {
        min-height: 80px;
        padding: 15px 10px;
    }
    
    .service-icon {
        width: 35px;
        height: 35px;
        font-size: 0.85rem;
    }
    
    .file-upload-label {
        padding: 12px;
        font-size: 0.9rem;
    }
    
    .file-upload-label span {
        font-size: 0.85rem;
    }
    
    .establecimientos-table td {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .establecimientos-table td:before {
        margin-bottom: 5px;
    }
    
    .establecimiento-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .establecimiento-thumb {
        width: 50px;
        height: 50px;
    }
    
    .table-actions {
        justify-content: flex-start;
    }
}

/* Móviles muy pequeños (hasta 360px) */
@media (max-width: 360px) {
    .establecimiento-header h1 {
        font-size: 1.2rem;
    }
    
    .establecimiento-subtitle {
        font-size: 0.85rem;
    }
    
    .form-label {
        font-size: 0.85rem;
    }
    
    .form-control {
        font-size: 0.9rem;
        padding: 8px 10px;
    }
    
    .btn-submit {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    .service-item {
        min-height: 85px;
    }
    
    .service-name {
        font-size: 0.75rem;
    }
    
    .service-select {
        font-size: 0.75rem;
        max-width: 100px;
    }
    
    .btn-action {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
}

/* Orientación horizontal en móviles */
@media (max-height: 500px) and (orientation: landscape) {
    .establecimiento-header {
        padding: 15px 20px;
    }
    
    .establecimiento-header h1 {
        font-size: 1.5rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .service-item {
        min-height: 70px;
        padding: 8px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #2c3e50;
        --light-bg: #34495e;
        --secondary-color: #ecf0f1;
        --border-color: #4a6572;
        --gray-light: #2c3e50;
    }
    
    .establecimiento-card {
        background: #34495e;
    }
    
    .form-control {
        background: #2c3e50;
        color: #ecf0f1;
        border-color: #4a6572;
    }
    
    .services-section {
        background: #2c3e50;
    }
    
    .service-item {
        background: #34495e;
    }
    
    .service-select {
        background: #2c3e50;
        color: #ecf0f1;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.establecimiento-card {
    animation: fadeIn 0.5s ease-out;
}

/* Scroll personalizado */
.establecimientos-table-container::-webkit-scrollbar {
    height: 6px;
}

.establecimientos-table-container::-webkit-scrollbar-track {
    background: var(--light-bg);
    border-radius: 4px;
}

.establecimientos-table-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.establecimientos-table-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .establecimiento-card:hover {
        transform: none;
    }
    
    .btn-submit:hover,
    .btn-action:hover {
        transform: none;
    }
}

/* Impresión */
@media print {
    .establecimiento-header,
    .btn-submit,
    .btn-refresh,
    .btn-action {
        display: none !important;
    }
    
    .establecimiento-card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
}