/* =============================================
   CRIBOX - Panel de Usuario (Dashboard)
   ============================================= */

/* ── Dashboard Topbar ── */
.dash-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #131d2f;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 1000;
    backdrop-filter: blur(12px);
}

.dash-topbar-inner {
    max-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.dash-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dash-topbar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.dash-topbar-logo {
    height: 30px;
    width: auto;
    object-fit: contain;
}

.dash-topbar-badge {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--yellow);
    background: rgba(255, 183, 3, 0.1);
    border: 1px solid rgba(255, 183, 3, 0.2);
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

.dash-topbar-menu {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.dash-topbar-menu:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.dash-topbar-menu i {
    width: 18px;
    height: 18px;
}

.dash-topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.dash-topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dash-topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(255, 183, 3, 0.12);
    border: 1px solid rgba(255, 183, 3, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--yellow);
}

.dash-topbar-avatar.admin {
    background: rgba(230, 57, 70, 0.12);
    border-color: rgba(230, 57, 70, 0.2);
    color: var(--red-light);
}

.dash-topbar-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.dash-topbar-link {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.dash-topbar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.dash-topbar-link i {
    width: 18px;
    height: 18px;
}

@media (max-width: 768px) {
    .dash-topbar-name {
        display: none;
    }
    
    .dash-topbar-menu {
        display: flex;
    }
}

/* ── Auth Pages (Login / Register) ── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px 24px 40px;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    top: -30%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 183, 3, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.auth-page::after {
    content: '';
    position: absolute;
    bottom: -30%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(45, 198, 83, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: 40px;
    position: relative;
    z-index: 2;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header .brand-text {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
}

.auth-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-form .form-label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.auth-form .form-label i {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.form-input-wrapper {
    position: relative;
}

.form-input-wrapper .form-input {
    padding-left: 44px;
}

.form-input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition-fast);
}

.form-input-wrapper:focus-within .form-input-icon {
    color: var(--yellow);
}

.form-input-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

.form-input-toggle:hover {
    color: var(--yellow);
}

.auth-form .btn-cta {
    margin-top: 24px;
    font-size: 1rem;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--yellow);
    font-weight: 600;
}

.auth-footer a:hover {
    color: var(--yellow-light);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ── Dashboard Layout ── */
.dashboard {
    display: flex;
    min-height: 100vh;
    padding-top: 68px;
}

.dashboard-sidebar {
    width: 260px;
    min-height: calc(100vh - 68px);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 24px 16px;
    position: fixed;
    top: 68px;
    left: 0;
    z-index: 50;
    transition: transform var(--transition-base);
    overflow-y: auto;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.sidebar-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gradient-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-user-info {
    min-width: 0;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-email {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: rgba(255, 183, 3, 0.1);
    color: var(--yellow);
    font-weight: 600;
}

.sidebar-link i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 16px 16px 8px;
    font-weight: 600;
}

.sidebar-link.logout {
    color: var(--red);
    margin-top: 16px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.sidebar-link.logout:hover {
    background: rgba(230, 57, 70, 0.1);
}

/* Dashboard Main */
.dashboard-main {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
    min-height: calc(100vh - 68px);
}

.dashboard-header {
    margin-bottom: 32px;
}

.dashboard-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.dashboard-subtitle {
    font-size: 0.92rem;
    color: var(--text-muted);
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-base);
}

.stat-card:hover {
    border-color: var(--border-active);
    transform: translateY(-2px);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card-icon i {
    width: 20px;
    height: 20px;
}

.stat-card-icon.green { background: rgba(45, 198, 83, 0.1); color: var(--green); }
.stat-card-icon.yellow { background: rgba(255, 183, 3, 0.1); color: var(--yellow); }
.stat-card-icon.red { background: rgba(230, 57, 70, 0.1); color: var(--red); }
.stat-card-icon.blue { background: rgba(59, 130, 246, 0.1); color: #3B82F6; }

.stat-card-value {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
}

.stat-card-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Panel Cards */
.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
}

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

.panel-card-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-card-title i {
    width: 18px;
    height: 18px;
    color: var(--yellow);
}

.panel-card-body {
    padding: 24px;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

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

.data-table td {
    padding: 14px 16px;
    font-size: 0.88rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

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

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.status-badge.pendiente {
    background: rgba(255, 183, 3, 0.1);
    color: var(--yellow);
    border: 1px solid rgba(255, 183, 3, 0.2);
}

.status-badge.cripto_recibida {
    background: rgba(59, 130, 246, 0.1);
    color: #3B82F6;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.status-badge.completada {
    background: rgba(45, 198, 83, 0.1);
    color: var(--green);
    border: 1px solid rgba(45, 198, 83, 0.2);
}

.status-badge.cancelada {
    background: rgba(230, 57, 70, 0.1);
    color: var(--red);
    border: 1px solid rgba(230, 57, 70, 0.2);
}

.status-badge i {
    width: 12px;
    height: 12px;
}

/* Profile form */
.profile-form {
    max-width: 700px;
}

.profile-form .form-group {
    margin-bottom: 20px;
}

.profile-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.profile-section-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    margin: 24px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.profile-section-title:first-child {
    margin-top: 0;
}

.profile-section-title i {
    width: 16px;
    height: 16px;
    color: var(--yellow);
}

.btn-save {
    padding: 12px 32px;
    background: var(--gradient-cta);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-glow-green);
    margin-top: 8px;
}

.btn-save:hover {
    background: var(--gradient-cta-hover);
    transform: translateY(-1px);
}

.btn-save i {
    width: 16px;
    height: 16px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: rgba(255, 183, 3, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state-icon i {
    width: 28px;
    height: 28px;
    color: var(--text-muted);
}

.empty-state-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: transparent;
    border: 1px solid var(--border-active);
    color: var(--yellow);
    font-family: var(--font-primary);
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-base);
}

.btn-outline:hover {
    background: rgba(255, 183, 3, 0.1);
    color: var(--yellow-light);
}

.btn-outline i {
    width: 16px;
    height: 16px;
}

/* Mobile toggle button - DEPRECATED, now in topbar */
.sidebar-toggle-mobile {
    display: none !important;
}

/* Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 40;
}

.sidebar-overlay.active {
    display: block;
}

/* Scrollable table wrapper */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Responsive Dashboard ── */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .dashboard-sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

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

    .dashboard-main {
        margin-left: 0;
        padding: 20px 16px;
    }

    .sidebar-toggle-mobile {
        display: none !important;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-title {
        font-size: 1.4rem;
    }

    .profile-form .form-row {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 28px 20px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 0.8rem;
    }
}

/* ── Alert Messages ── */
.alert-message {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    display: none;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.alert-message.visible {
    display: flex;
}

.alert-message.error {
    background: rgba(230, 57, 70, 0.08);
    border: 1px solid rgba(230, 57, 70, 0.2);
    color: var(--red-light);
}

.alert-message.success {
    background: rgba(45, 198, 83, 0.08);
    border: 1px solid rgba(45, 198, 83, 0.2);
    color: var(--green-light);
}


/* (select, textarea, form-row styles now in style.css) */


/* ── Panel card clickable ── */
.panel-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

a .panel-card:hover,
a:hover .panel-card {
    border-color: var(--border-active);
}

/* ── Ticket message thread ── */
.ticket-msg {
    margin-bottom: 16px;
    padding: 14px;
    border-radius: var(--radius-sm);
}

.ticket-msg-user {
    background: var(--bg-input);
    border-left: 3px solid var(--border-color);
}

.ticket-msg-admin {
    background: rgba(255, 183, 3, 0.06);
    border-left: 3px solid var(--yellow);
}

/* ── Badge count ── */
.badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--red);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    margin-left: auto;
}

/* ── Stats grid 2 cols ── */
@media (max-width: 768px) {
    .stats-grid + div {
        grid-template-columns: 1fr !important;
    }
}
