/* ========================================
   BEAMX1 Demo v2 — Dashboard
   Profile + training list + history
   ======================================== */

.dashboard-screen {
    min-height: 100vh;
}

/* Dashboard Header */
.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-xl);
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.dash-header-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.dash-logo {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 800;
}

.dash-logo span {
    color: var(--beam);
}

.dash-user-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.dash-user-info .avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--beam-soft);
    border: 1px solid var(--beam);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--beam);
}

.dash-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Dashboard Content */
.dash-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-xl);
}

/* Profile Card */
.profile-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-xl);
    align-items: start;
    margin-bottom: var(--space-2xl);
}

.profile-avatar-wrap {
    position: relative;
    width: 80px;
    height: 107px;
    flex-shrink: 0;
}

.profile-avatar {
    width: 80px;
    height: 107px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--beam-soft), var(--bg-tertiary));
    border: 2px solid var(--beam);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.profile-avatar-initials {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--beam);
    font-family: var(--font-display);
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-avatar-edit {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--beam);
    border: 2px solid var(--bg-card);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    padding: 0;
}

.profile-avatar-edit:hover {
    transform: scale(1.1);
    box-shadow: 0 0 12px var(--beam-glow);
}

.profile-avatar-edit svg {
    width: 14px;
    height: 14px;
}

.profile-details {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.profile-fields-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-field-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 500;
}

.profile-field-value {
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-weight: 500;
}

.profile-note-full {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-note-full .profile-field-value {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.875rem;
}

/* Sensor permissions on profile */
.profile-sensors {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-admin {
    margin-top: var(--space-xs);
}

.sensor-permissions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.sensor-perm-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.sensor-perm-btn:hover {
    border-color: var(--beam);
    color: var(--text-primary);
}

.sensor-perm-btn.granted {
    border-color: var(--beam);
    background: var(--beam-soft);
    color: var(--beam);
}

.sensor-perm-btn.granted svg {
    color: var(--beam);
}

.sensor-perm-btn.denied {
    border-color: var(--danger);
    color: var(--danger);
}

.sensor-perm-btn .sensor-perm-status {
    font-weight: 700;
    color: var(--beam);
}

.sensor-perm-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color var(--duration) var(--ease);
}

/* Auto-granted devices (screen, mouse) */
.sensor-perm-btn.auto {
    opacity: 0.7;
    cursor: default;
}

.sensor-perm-btn.auto.granted {
    opacity: 0.7;
}

/* Speaker Modal */
.speaker-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.speaker-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    width: 100%;
    max-width: 400px;
    margin: var(--space-md);
    animation: modalSlideUp 0.3s var(--ease);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.speaker-modal-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.speaker-modal-header svg {
    color: var(--beam);
    flex-shrink: 0;
}

.speaker-modal-header h3 {
    font-size: 1.125rem;
}

.speaker-modal-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-xl);
}

.speaker-modal-volume {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.speaker-modal-volume svg {
    color: var(--beam);
    flex-shrink: 0;
}

.volume-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 3px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--beam);
    cursor: pointer;
    border: 3px solid var(--bg-card);
    box-shadow: 0 0 8px var(--beam-glow);
}

.volume-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--beam);
    cursor: pointer;
    border: 3px solid var(--bg-card);
}

.volume-value {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-primary);
    min-width: 40px;
    text-align: right;
    font-weight: 600;
}

.speaker-modal-buttons {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
}

/* Photo Preview Modal */
.photo-preview-box {
    text-align: center;
    animation: modalSlideUp 0.3s var(--ease);
}

.photo-preview-img {
    width: 250px;
    height: 333px;
    border-radius: var(--radius-xl);
    border: 3px solid var(--beam);
    object-fit: cover;
    box-shadow: 0 0 40px var(--beam-glow);
    cursor: pointer;
}

.photo-preview-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
    margin-top: var(--space-md);
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.profile-avatar {
    cursor: pointer;
}

/* Missing sensor warning on training card */
.training-missing {
    font-size: 0.75rem;
    color: var(--warning);
    font-style: italic;
}

/* Section Title */
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.section-title h2 {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.section-title h2 svg {
    width: 22px;
    height: 22px;
    color: var(--beam);
}

/* Training Card */
.training-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
}

.training-card {
    display: flex;
    flex-direction: column;
    cursor: default;
}

.training-card:hover {
    border-color: var(--beam);
    box-shadow: var(--shadow-glow);
}

/* Main row — 4/5 info + 1/5 side */
.tc-main {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-lg);
    align-items: start;
}

.tc-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.tc-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-sm);
    flex-shrink: 0;
}

/* Toggle button */
.tc-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 4px 0;
    cursor: pointer;
    color: var(--beam);
    font-size: 0.75rem;
    font-weight: 500;
    font-family: var(--font-body);
    margin-top: var(--space-xs);
}

.tc-toggle:hover { opacity: 0.8; }

.tc-toggle-icon {
    transition: transform 0.2s;
}

.training-card.expanded .tc-toggle-icon {
    transform: rotate(180deg);
}

/* Collapsible details */
.tc-details {
    display: none;
    border-top: 1px solid var(--border);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
}

.training-card.expanded .tc-details {
    display: block;
}

.training-meta {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.training-name {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
}

.training-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Training card sections */
.training-section {
    margin-top: var(--space-sm);
}

.training-section-label {
    display: block;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 6px;
}

/* Required devices in training card */
.tc-devices {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tc-device {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transition: all var(--duration) var(--ease);
}

.tc-device svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.tc-device.granted {
    border-color: rgba(16, 185, 129, 0.3);
    background: var(--beam-soft);
    color: var(--beam);
}

.tc-device.granted svg {
    color: var(--beam);
}

.tc-device.missing {
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--text-muted);
}

.tc-device.missing svg {
    color: var(--text-muted);
}

.tc-device-status {
    font-weight: 700;
    font-size: 0.7rem;
}

.tc-device.granted .tc-device-status {
    color: var(--beam);
}

.tc-device.missing .tc-device-status {
    color: var(--danger);
    opacity: 0.6;
}

/* Tracked metrics tags */
.training-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.training-consent {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    background: var(--beam-soft);
    border-radius: var(--radius-md);
    margin-top: var(--space-sm);
}

.training-consent svg {
    color: var(--beam);
    flex-shrink: 0;
    margin-top: 1px;
}

.training-consent span {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Start button wrapper for tooltip */
.start-btn-wrap {
    position: relative;
}

/* Square start button */
.tc-start-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100px;
    height: 100px;
    border-radius: var(--radius-xl);
    border: 2px solid var(--border);
    background: var(--bg-card);
    cursor: not-allowed;
    transition: all var(--duration) var(--ease);
    padding: var(--space-sm);
}

.tc-start-btn svg {
    color: var(--text-muted);
    transition: color var(--duration);
}

.tc-start-btn.ready {
    border-color: var(--beam);
    background: var(--beam-soft);
    cursor: pointer;
}

.tc-start-btn.ready svg {
    color: var(--beam);
}

.tc-start-btn.ready:hover {
    background: var(--beam);
    border-color: var(--beam);
    box-shadow: var(--shadow-glow);
}

.tc-start-btn.ready:hover svg,
.tc-start-btn.ready:hover .tc-start-label,
.tc-start-btn.ready:hover .tc-start-duration {
    color: white;
}

.tc-start-btn.disabled {
    opacity: 0.5;
}

.tc-start-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: color var(--duration);
}

.tc-start-duration {
    font-size: 0.6875rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    transition: color var(--duration);
}

/* History Section */
.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.history-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--space-md);
    align-items: center;
    padding: var(--space-md) var(--space-lg);
}

.history-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--beam);
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.history-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.history-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.btn-delete-result {
    color: var(--text-muted) !important;
    padding: 4px 6px !important;
    transition: color var(--duration) var(--ease);
}

.btn-delete-result:hover {
    color: var(--danger) !important;
}

.history-empty {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .dash-header {
        flex-direction: column;
        gap: var(--space-md);
        padding: var(--space-md);
    }

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

    .profile-avatar {
        width: 60px;
        height: 60px;
        font-size: 1.25rem;
    }

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

    .training-card {
        grid-template-columns: 1fr;
    }

    .training-actions {
        flex-direction: row;
        align-items: center;
    }

    .history-item {
        grid-template-columns: auto 1fr auto;
    }

    .dash-content {
        padding: var(--space-lg) var(--space-md);
    }
}

/* ========================================
   Admin — link to admin page
   ======================================== */
.profile-admin {
    margin-top: var(--space-sm);
}

.profile-admin .btn {
    text-decoration: none;
}
