/* ============================================================
   Tarta - Academia de Repostería
   Hoja de estilos principal
   ============================================================ */

/* ── Variables de color ── */
:root {
    --color-cafe: #76401c;
    --color-miel: #ffaf22;
    --color-abano: #e1cda6;
    --color-abano-soft: #f1e5cd;
    --color-cafe-soft: #9b6a4a;
}

/* ── Base ── */
body { font-family: 'Inter', sans-serif; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.gradient-bg { background: linear-gradient(135deg, var(--color-abano-soft) 0%, var(--color-abano) 100%); }
.card { background: white; border-radius: 0.875rem; box-shadow: 0 1px 3px rgba(118, 64, 28, 0.05), 0 6px 20px rgba(118, 64, 28, 0.09); border: 1px solid rgba(225, 205, 166, 0.65); }
.btn-primary { background-color: var(--color-cafe); color: white; }
.btn-primary:hover { opacity: 0.9; }
.input-field { border: 1px solid #d1d5db; border-radius: 0.5rem; padding: 0.55rem 0.75rem; transition: border-color 0.15s, box-shadow 0.15s; }
.input-field:focus { outline: none; border-color: var(--color-cafe-soft); box-shadow: 0 0 0 3px rgba(118, 64, 28, 0.08); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.5rem; text-align: left; border-bottom: 1px solid #e5e7eb; }

/* ── Overrides de Tailwind para mantener paleta consistente ── */
.from-amber-700 {
    --tw-gradient-from: var(--color-cafe) var(--tw-gradient-from-position) !important;
    --tw-gradient-to: rgb(118 64 28 / 0) var(--tw-gradient-to-position) !important;
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}

.to-orange-500 {
    --tw-gradient-to: var(--color-miel) var(--tw-gradient-to-position) !important;
}

.text-amber-700,
.text-amber-600,
.text-amber-800,
.text-amber-900,
.hover\:text-amber-800:hover {
    color: var(--color-cafe) !important;
}

.text-orange-100 {
    color: #ffffff !important;
}

.hover\:bg-amber-50:hover,
.bg-amber-50,
.bg-orange-50 {
    background-color: var(--color-abano-soft) !important;
}

.border-amber-600,
.border-amber-200,
.border-orange-200,
.border-orange-300,
.border-orange-400,
.hover\:border-orange-300:hover {
    border-color: var(--color-cafe-soft) !important;
}

/* ── Sidebar móvil ── */
.mobile-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
}

.mobile-sidebar.open {
    transform: translateX(0);
}

/* ── Tablas con scroll horizontal en móvil ── */
.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}

.table-scroll .table {
    min-width: 680px;
}

.table-scroll.table-wide .table {
    min-width: 1024px;
}

@media (max-width: 768px) {
    #rentabilidad .table th,
    #rentabilidad .table td {
        white-space: nowrap;
        font-size: 0.82rem;
        padding: 0.45rem;
    }
}

/* ── Info Cards (pestaña Ayuda) ── */
.info-card {
    display: flex;
    gap: 1.25rem;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 4px 18px 0 rgba(118,64,28,0.12);
    border: 1px solid var(--color-abano);
    padding: 1.5rem;
    align-items: flex-start;
    transition: box-shadow 0.2s;
}
.info-card:hover { box-shadow: 0 8px 28px 0 rgba(118,64,28,0.18); }

.info-card__icon-wrap {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.info-card__icon { width: 26px; height: 26px; }
.info-card__icon-wrap--autor   { background: linear-gradient(135deg,#76401c,#c47a3a); color:#fff; }
.info-card__icon-wrap--licencia { background: linear-gradient(135deg,#4a3070,#7b55b2); color:#fff; }
.info-card__icon-wrap--comercial { background: linear-gradient(135deg,#c0392b,#e74c3c); color:#fff; }

.info-card__body { flex: 1; min-width: 0; }
.info-card__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-cafe);
    margin-bottom: 0.35rem;
}
.info-card--licencia .info-card__title { color: #4a3070; }
.info-card--comercial .info-card__title { color: #c0392b; }
.info-card__desc { font-size: 0.875rem; color: #555; margin-bottom: 0.75rem; }
.info-card__data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem 1rem; margin-bottom: 0.85rem; }
@media(max-width:600px){ .info-card__data-grid{ grid-template-columns:1fr; } }
.info-card__data-item { display: flex; flex-direction: column; gap: 2px; }
.info-card__label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #999; }
.info-card__value { font-size: 0.9rem; font-weight: 600; color: #333; }
.info-card__value--highlight { color: var(--color-cafe); font-size: 0.95rem; }
.info-card__link { color: var(--color-cafe); text-decoration: none; font-weight: 600; }
.info-card__link:hover { text-decoration: underline; }
.info-card__note { font-size: 0.78rem; color: #888; margin-top: 0.5rem; border-top: 1px solid var(--color-abano); padding-top: 0.5rem; }
.info-card__list { list-style: none; padding: 0; margin: 0.5rem 0 0.85rem 0; }
.info-card__list li { font-size: 0.85rem; color: #444; padding: 0.3rem 0 0.3rem 1.2rem; position: relative; }
.info-card__list li::before { content: '•'; position: absolute; left: 0; color: var(--color-cafe); font-weight: 700; }
.info-card--licencia .info-card__list li::before { color: #7b55b2; }
.info-card--comercial .info-card__list li::before { color: #c0392b; }

.info-card__badge {
    display: inline-block;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    background: var(--color-abano-soft);
    color: var(--color-cafe);
    border: 1px solid var(--color-abano);
}
.info-card__badge--comercial { background: #fdecea; color: #c0392b; border-color: #f5c6c6; }

.info-card__brand-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--color-abano-soft);
    border: 1px solid var(--color-abano);
    border-radius: 0.6rem;
    padding: 0.85rem 1rem;
    margin-bottom: 0.85rem;
}
.info-card__brand-info { display: flex; flex-direction: column; gap: 0.25rem; }
.info-card__brand-name { font-size: 1rem; font-weight: 700; color: var(--color-cafe); }
.info-card__brand-handle { font-size: 0.85rem; color: #c0392b; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; }
.info-card__brand-handle:hover { text-decoration: underline; }

@media(max-width:480px){
    .info-card { flex-direction: column; }
    .info-card__icon-wrap { width: 42px; height: 42px; }
}

/* ── Auth Overlay ── */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--color-abano-soft) 0%, var(--color-abano) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.auth-card {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 8px 32px rgba(118, 64, 28, 0.22);
    border: 1px solid var(--color-abano);
    padding: 2rem;
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-logo {
    height: 72px;
    width: auto;
    border-radius: 8px;
    margin: 0 auto 0.75rem;
    display: block;
    object-fit: contain;
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--color-cafe);
    line-height: 1.2;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--color-cafe-soft);
    margin-top: 0.2rem;
}

.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--color-abano);
    margin-bottom: 1.5rem;
}

.auth-tab {
    flex: 1;
    padding: 0.6rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #999;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.2s;
}

.auth-tab.active {
    color: var(--color-cafe);
    border-bottom-color: var(--color-cafe);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form.hidden { display: none; }

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.auth-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
}

.auth-field input {
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.auth-field input:focus {
    border-color: var(--color-cafe);
    box-shadow: 0 0 0 3px rgba(118, 64, 28, 0.12);
}

.auth-btn-primary {
    background-color: var(--color-cafe);
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 0.25rem;
    width: 100%;
}

.auth-btn-primary:hover   { opacity: 0.88; }
.auth-btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.auth-link {
    background: none;
    border: none;
    color: var(--color-cafe-soft);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: center;
    text-decoration: underline;
    padding: 0;
    transition: color 0.2s;
}

.auth-link:hover { color: var(--color-cafe); }

.auth-message {
    padding: 0.7rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.45;
    margin-bottom: 0.25rem;
}

.auth-message.error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.auth-message.success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.auth-message.hidden { display: none; }

.auth-hint {
    font-size: 0.875rem;
    color: #666;
    line-height: 1.5;
    margin: 0;
}

/* Spinner de carga dentro del botón */
.auth-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin 0.7s linear infinite;
    margin-right: 7px;
    vertical-align: middle;
}

@keyframes auth-spin {
    to { transform: rotate(360deg); }
}

/* Botones de acción en el header */
#logoutBtn,
#myAccountBtn {
    border: 1px solid rgba(255, 255, 255, 0.6);
    color: #fff;
    background: transparent;
    transition: background 0.2s;
}

#logoutBtn:hover,
#myAccountBtn:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* ── Barra de navegación por tabs ── */
.tab-nav {
    border-radius: 0.875rem;
    box-shadow: 0 1px 3px rgba(118, 64, 28, 0.05), 0 4px 14px rgba(118, 64, 28, 0.08);
}

/* ── Iconos dentro de los botones de tab ── */
.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

#mobileSidebar .tab-btn {
    display: flex;
}

.tab-btn .ti {
    font-size: 1.05rem;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.72;
}

.tab-btn.active .ti,
.tab-btn:hover .ti {
    opacity: 1;
}

/* ── Encabezados de sección ── */
.section-header {
    margin-bottom: 1.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(225, 205, 166, 0.55);
}

.section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-cafe);
    line-height: 1.3;
    margin: 0;
}

.section-subtitle {
    font-size: 0.8125rem;
    color: #9ca3af;
    margin: 0.25rem 0 0;
    line-height: 1.45;
}

/* ── Mi Cuenta Panel ── */
.account-panel {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--color-abano-soft) 0%, var(--color-abano) 100%);
    z-index: 500;
    overflow-y: auto;
    padding: 1.5rem 1rem 3rem;
}

.account-panel__content {
    max-width: 680px;
    margin: 0 auto;
}

.account-panel__header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.account-panel__title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-cafe);
    margin: 0;
}

.account-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #fff;
    color: var(--color-cafe);
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(118, 64, 28, 0.12);
    transition: box-shadow 0.2s;
    flex-shrink: 0;
}

.account-back-btn:hover {
    box-shadow: 0 4px 14px rgba(118, 64, 28, 0.18);
}

.account-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem 2rem;
}

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

.account-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.account-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #999;
}

.account-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    word-break: break-word;
}

.account-value--highlight {
    color: var(--color-cafe);
    font-size: 1rem;
}

.account-link {
    color: var(--color-cafe);
    text-decoration: none;
}

.account-link:hover { text-decoration: underline; }

.account-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
}

/* ── Header: botón Guardar compacto ── */
.header-save-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #fff;
    color: var(--color-cafe);
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.header-save-btn:hover { opacity: 0.88; }
.header-save-btn .ti   { font-size: 1rem; }

/* ── Avatar circular del usuario ── */
.header-user-menu { position: relative; }

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.55);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.user-avatar:hover { background: rgba(255, 255, 255, 0.32); }

/* ── Menú desplegable ── */
.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 210px;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 4px 24px rgba(118, 64, 28, 0.18), 0 1px 4px rgba(118, 64, 28, 0.10);
    border: 1px solid rgba(225, 205, 166, 0.6);
    z-index: 300;
    overflow: hidden;
}

.user-dropdown__email {
    padding: 0.7rem 1rem 0.6rem;
    font-size: 0.775rem;
    font-weight: 600;
    color: #999;
    word-break: break-all;
    border-bottom: 1px solid rgba(225, 205, 166, 0.5);
}

.user-dropdown__item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #333;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.13s;
}

.user-dropdown__item:hover {
    background: var(--color-abano-soft);
    color: var(--color-cafe);
}

.user-dropdown__item .ti {
    font-size: 1rem;
    color: var(--color-cafe-soft);
    flex-shrink: 0;
}

.user-dropdown__item:hover .ti { color: var(--color-cafe); }

.user-dropdown__item--danger,
.user-dropdown__item--danger .ti { color: #c0392b; }

.user-dropdown__item--danger:hover { background: #fdecea; }
.user-dropdown__item--danger:hover .ti { color: #c0392b; }

.user-dropdown__separator {
    height: 1px;
    background: rgba(225, 205, 166, 0.5);
    margin: 0.3rem 0;
}
