/* ============================================
   ESTILOS MEJORADOS - MISCELANEA BEAUTY
   ============================================ */

:root {
    --green: #9ec99b;
    --green-dark: #7ab577;
    --green-light: #eef7ed;
    --text: #2d2d2d;
    --text-muted: #888;
    --border: #e4e4e4;
    --white: #fff;
    --bg: #f5f5f5;
    --blue: #5b7cfa;
    --radius: 10px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Urbanist', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ── Layout ── */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.results-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* ── Título ── */
.results-section h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--green-dark) 0%, var(--green) 50%, transparent 100%);
    border-image-slice: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.results-section h3 i {
    color: var(--green-dark);
    font-size: 1.5rem;
}

/* ── Alertas ── */
.alert {
    padding: 0.875rem 1.25rem;
    margin-bottom: 1.25rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.alert i {
    font-size: 1.1rem;
}

.alert-success {
    background: #f0fdf4;
    border-left: 3px solid #22c55e;
    color: #15803d;
}

.alert-error {
    background: #fef2f2;
    border-left: 3px solid #ef4444;
    color: #b91c1c;
}

/* ── Buscador ── */
.search-container {
    margin-bottom: 1.5rem;
}

.search-form {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper > i {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    pointer-events: none;
    font-size: 1rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 2.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--green-dark);
    box-shadow: 0 0 0 3px rgba(122, 181, 119, 0.1);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.clear-search {
    position: absolute;
    right: 0.875rem;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.clear-search:hover {
    color: #ef4444;
    background: #fef2f2;
}

.btn-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--green-dark);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
    min-width: 120px;
}

.btn-search:hover {
    background: #6aab67;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-search:active {
    transform: translateY(0);
}

.search-results-info {
    margin-top: 0.875rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-results-info strong {
    color: var(--text);
}

/* ── Tabla ── */
.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    max-height: calc(100vh - 300px);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    min-width: 900px;
}

/* Cabecera */
table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

table thead th {
    padding: 1.1rem 1.5rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    background: linear-gradient(135deg, var(--green-dark) 0%, #6aab67 100%);
    white-space: nowrap;
    border-bottom: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

table thead th:last-child {
    text-align: center;
}

table thead th:first-child {
    border-top-left-radius: var(--radius);
    width: 80px;
    text-align: center;
}

table thead th:last-child {
    border-top-right-radius: var(--radius);
}

table thead th i {
    margin-right: 0.6rem;
    opacity: 1;
    font-size: 1rem;
    vertical-align: middle;
}

/* Filas */
table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: all 0.15s ease;
}

table tbody tr:hover {
    background: var(--green-light);
}

table tbody tr:last-child {
    border-bottom: none;
}

/* Celdas */
table tbody td {
    padding: 1.1rem 1.5rem;
    font-size: 0.9rem;
    color: var(--text);
    vertical-align: middle;
}

table tbody td:last-child {
    text-align: center;
}

table tbody td:first-child {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    width: 80px;
    text-align: center;
}

table tbody td:nth-child(2) {
    font-weight: 600;
    color: var(--green-dark);
}

table tbody td strong {
    font-weight: 700;
    color: var(--green-dark);
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge i {
    font-size: 0.75rem;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}

.badge-admin {
    background: #fef9c3;
    color: #854d0e;
    border-color: #fde047;
}

.badge-client {
    background: #f3e8ff;
    color: #6b21a8;
    border-color: #d8b4fe;
}

/* ── Botones de acción ── */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: nowrap;
    align-items: center;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
    min-width: 100px;
}

.btn-action i {
    font-size: 0.85rem;
}

.btn-action:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-action:active {
    transform: translateY(0);
}

.btn-update {
    background: var(--blue);
    color: white;
}

.btn-update:hover {
    background: #4a6de8;
}

.btn-delete {
    background: var(--green);
    color: white;
}

.btn-delete:hover {
    background: #8db98a;
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.25;
}

.empty-state p {
    font-size: 1rem;
}

/* ── Botones generales ── */
.button-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.btn,
.btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.2s ease;
    min-width: 140px;
}

.btn-back {
    background: #5a6268;
    color: white;
}

.btn-back:hover {
    background: #4a525a;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: var(--green-dark);
    color: white;
}

.btn-primary:hover {
    background: #6aab67;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active,
.btn-back:active {
    transform: translateY(0);
}

/* ── Formularios ── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.form-group label i {
    color: var(--green-dark);
    font-size: 0.85rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.7rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background: white;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--green-dark);
    box-shadow: 0 0 0 3px rgba(122, 181, 119, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.button-group.full-width {
    grid-column: 1 / -1;
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 0.75rem;
}

.product-img-preview {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* ── Estados de validación ── */
.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: #ef4444;
}

.form-group input.success,
.form-group select.success,
.form-group textarea.success {
    border-color: #22c55e;
}

.form-error-message {
    font-size: 0.8rem;
    color: #ef4444;
    margin-top: 0.25rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .results-section {
        padding: 1.25rem;
    }
    
    .results-section h3 {
        font-size: 1.25rem;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .btn-search {
        width: 100%;
        justify-content: center;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn-action {
        width: 100%;
        justify-content: center;
        min-width: auto;
    }
    
    .table-wrapper {
        max-height: calc(100vh - 250px);
    }
    
    table thead th,
    table tbody td {
        padding: 0.75rem 0.875rem;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn,
    .btn-back {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.75rem;
    }
    
    .results-section {
        padding: 1rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Animaciones ── */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-section {
    animation: fadeIn 0.3s ease;
}

/* ── Utilidades ── */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.hidden {
    display: none;
}

.visible {
    display: block;
}