/* ============================================
   GuadalupeGO Admin Dashboard - Styles
   ============================================ */

/* --- CSS Variables --- */
:root {
    --primary: #F97316;
    --primary-hover: #E96928;
    --primary-light: #FFF7ED;
    --primary-border: #FDBA74;
    --background: #F3F4F6;
    --card: #FFFFFF;
    --text-primary: #1E293B;
    --text-secondary: #6B7280;
    --success: #22C55E;
    --success-hover: #16A34A;
    --danger: #EF4444;
    --danger-hover: #DC2626;
    --warning: #F59E0B;
    --warning-hover: #D97706;
    --info: #3B82F6;
    --info-hover: #2563EB;
    --border: #E5E7EB;
    --header-bg: #F9FAFB;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.12);
    --radius: 8px;
    --radius-sm: 4px;
    --sidebar-width: 220px;
    --sidebar-collapsed: 56px;
    --transition: 0.3s ease;
}

/* --- Reset / Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
}

h1 { font-size: 24px; font-weight: 700; margin-bottom: 20px; }
h2 { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }

/* --- Layout --- */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 24px;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition);
    min-width: 0;
}

.sidebar.collapsed ~ .main-content,
.sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width var(--transition);
    z-index: 100;
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    min-height: 60px;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sidebar-brand {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition);
}

.sidebar.collapsed .sidebar-brand {
    opacity: 0;
    width: 0;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 8px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 18px;
    transition: background var(--transition);
}

.sidebar-toggle:hover {
    background: var(--header-bg);
}

.sidebar-nav {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    margin-bottom: 2px;
}

.sidebar-item:hover {
    background: var(--header-bg);
    color: var(--text-primary);
}

.sidebar-item.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary-border);
    font-weight: 600;
}

.sidebar-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-text {
    overflow: hidden;
    transition: opacity var(--transition);
}

.sidebar.collapsed .sidebar-text {
    opacity: 0;
    width: 0;
}

.sidebar-badge {
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-badge {
    display: none;
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: 8px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    font-weight: 500;
}

/* --- Login Page --- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--background);
}

.login-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 16px;
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.login-error {
    background: #FEF2F2;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.login-error.show {
    display: block;
}

.login-step {
    display: none;
}

.login-step.active {
    display: block;
}

/* --- Cards / Stats --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: block;
    color: inherit;
    transition: box-shadow 0.15s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    color: inherit;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-number.orange { color: var(--primary); }
.stat-number.red { color: var(--danger); }
.stat-number.blue { color: var(--info); }
.stat-number.dark { color: var(--text-primary); }

/* --- Card container --- */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

/* --- Tables --- */
.table-container {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--header-bg);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

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

.data-table .actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: #DCFCE7;
    color: #166534;
}

.badge-danger {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

.badge-info {
    background: #DBEAFE;
    color: #1E40AF;
}

.badge-secondary {
    background: #F3F4F6;
    color: #4B5563;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

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

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

.btn-primary:hover {
    background: var(--primary-hover);
}

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

.btn-success:hover {
    background: var(--success-hover);
}

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

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-secondary {
    background: var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #D1D5DB;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-sm);
}

/* --- Modals --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin-bottom: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    line-height: 1;
}

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

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

/* --- Forms --- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--card);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

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

select.form-control {
    cursor: pointer;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

/* --- Tabs --- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    gap: 0;
}

.tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s ease;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* --- Toast Notifications --- */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 360px;
}

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

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--danger);
}

.toast-warning {
    background: var(--warning);
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    background: none;
    border: 1px solid var(--border);
}

.page-link:hover {
    background: var(--header-bg);
    color: var(--text-primary);
}

.page-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-link:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- Photo Grid --- */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.photo-card {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card);
    box-shadow: var(--shadow);
    cursor: pointer;
    aspect-ratio: 1;
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-card .photo-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: none;
    align-items: center;
    justify-content: center;
}

.photo-card:hover .photo-delete {
    display: flex;
}

.photo-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
    padding: 20px 10px 10px;
    font-size: 11px;
}

/* --- Lightbox --- */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.lightbox.show {
    display: flex;
}

.lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
}

/* --- Stars --- */
.stars {
    color: var(--warning);
    font-size: 14px;
    letter-spacing: 1px;
}

/* --- Search --- */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.search-bar .form-control {
    max-width: 300px;
}

/* --- Page Header --- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-header h1 {
    margin-bottom: 0;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 14px;
}

/* --- Utilities --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-secondary { color: var(--text-secondary); }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }

    .sidebar .sidebar-text,
    .sidebar .sidebar-brand {
        opacity: 0;
        width: 0;
    }

    .sidebar .sidebar-badge {
        display: none;
    }

    .main-content {
        margin-left: var(--sidebar-collapsed);
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        flex-direction: column;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .tabs {
        overflow-x: auto;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }
}

/* Fotos en modal detalle */
.detalle-fotos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.detalle-foto {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.2s;
}

.detalle-foto:hover {
    transform: scale(1.05);
}
