/**
 * Desmos Auth & My Projects Drawer Styling
 */
.desmos-auth-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    z-index: 2500 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.desmos-auth-modal-backdrop.hidden-modal {
    display: none !important;
}

.desmos-auth-box {
    width: 380px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.projects-box {
    width: 480px;
    max-height: 80vh;
}

.auth-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auth-header h2 {
    font-size: 17px;
    font-weight: 700;
    color: #1d2939;
}

.btn-close-modal {
    background: transparent;
    border: none;
    font-size: 18px;
    color: #98a2b3;
    cursor: pointer;
}

.auth-tabs {
    display: flex;
    background: #f2f4f7;
    border-radius: 6px;
    padding: 3px;
}

.auth-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #475467;
    border-radius: 4px;
    cursor: pointer;
}

.auth-tab.active {
    background: #ffffff;
    color: #1d2939;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: #344054;
}

.form-group input {
    padding: 8px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}

.form-group input:focus {
    border-color: #2d70b3;
    box-shadow: 0 0 0 2px rgba(45, 112, 179, 0.15);
}

.btn-submit-auth {
    background: #2d70b3;
    color: #ffffff;
    border: none;
    padding: 9px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    margin-top: 4px;
}

.btn-submit-auth:hover {
    background: #245b91;
}

.auth-error-msg {
    font-size: 12px;
    color: #d92d20;
    font-weight: 500;
}

/* Projects List */
.projects-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 55vh;
    overflow-y: auto;
}

.empty-projects {
    font-size: 13px;
    color: #667085;
    text-align: center;
    padding: 20px 0;
}

.project-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid #eaecf0;
    border-radius: 6px;
    background: #f9fafb;
}

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

.project-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #1d2939;
}

.project-date {
    font-size: 11px;
    color: #667085;
}

.project-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-open-proj {
    background: #2d70b3;
    color: #ffffff;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
}

.btn-del-proj {
    background: transparent;
    border: none;
    color: #98a2b3;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
}

.btn-del-proj:hover {
    color: #d92d20;
}

/* =========================================================
   INDIVIDUAL USER DASHBOARD & PROJECT MANAGEMENT VIEW
   ========================================================= */

.user-dashboard-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #f8fafc;
    z-index: 1300;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1e293b;
}

.user-dashboard-view.hidden-dashboard {
    display: none !important;
}

/* Dashboard Header */
.dashboard-header {
    height: 60px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.dash-logo {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-badge-tag {
    font-size: 11px;
    font-weight: 700;
    background: #2563eb;
    color: #ffffff;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.btn-dash-secondary {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-dash-secondary:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.dash-user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 4px 12px 4px 6px;
    border-radius: 30px;
}

.dash-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dash-user-meta {
    display: flex;
    flex-direction: column;
}

.dash-user-name {
    font-size: 12.5px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.1;
}

.dash-user-email {
    font-size: 10.5px;
    color: #64748b;
}

.btn-dash-logout {
    background: transparent;
    border: none;
    color: #dc2626;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
}

.btn-dash-logout:hover {
    background: #fee2e2;
}

/* Dashboard Body */
.dashboard-main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px 60px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #ffffff;
    border-radius: 12px;
    padding: 28px 32px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
}

.hero-text h1 {
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 6px 0;
}

.hero-text p {
    font-size: 14px;
    color: #94a3b8;
    margin: 0;
}

.btn-dash-primary {
    background: #2563eb;
    color: #ffffff;
    border: none;
    font-size: 13.5px;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
}

.btn-dash-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

/* Stats Row */
.dashboard-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.stat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.stat-val {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
}

.stat-lbl {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-badge-green {
    font-size: 16px;
    color: #16a34a;
}

/* Toolbar */
.dashboard-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 18px;
}

.dash-search-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dash-search-input {
    width: 100%;
    max-width: 450px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
}

.dash-search-input:focus {
    border-color: #2563eb;
}

.dash-sort-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: #475467;
}

.dash-sort-select {
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 12.5px;
    outline: none;
    background: #ffffff;
}

/* Projects Cards Grid */
.projects-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 20px;
}

.project-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: transform 0.15s, box-shadow 0.15s;
}

.project-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.card-preview-box {
    height: 100px;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-expr-badge {
    position: absolute;
    bottom: 6px;
    right: 8px;
    background: rgba(15, 23, 42, 0.7);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.card-content {
    padding: 14px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.project-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-updated-time {
    font-size: 11px;
    color: #64748b;
}

.card-footer-actions {
    padding: 10px 16px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fafafa;
}

.btn-open-proj {
    background: #2563eb;
    color: #ffffff;
    border: none;
    font-size: 11.5px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-open-proj:hover {
    background: #1d4ed8;
}

.card-icon-actions {
    display: flex;
    gap: 4px;
}

.btn-card-action {
    background: transparent;
    border: none;
    font-size: 14px;
    padding: 5px 7px;
    border-radius: 4px;
    cursor: pointer;
    color: #64748b;
    transition: background 0.1s, color 0.1s;
}

.btn-card-action:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.btn-card-action.btn-delete:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* Create New Card */
.create-card {
    border: 2px dashed #cbd5e1;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    cursor: pointer;
    text-align: center;
    min-height: 200px;
}

.create-card:hover {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.03);
}

.create-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #e2e8f0;
    font-size: 24px;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.create-card h3 {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px 0;
}

.create-card p {
    font-size: 11.5px;
    color: #64748b;
    margin: 0;
}

/* Empty states */
.dashboard-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.empty-icon {
    font-size: 40px;
}

.dashboard-loading, .dashboard-error {
    text-align: center;
    padding: 80px 20px;
}

.dash-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #cbd5e1;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: dashSpin 0.7s linear infinite;
    margin: 0 auto 12px;
}

@keyframes dashSpin {
    to { transform: rotate(360deg); }
}

/* SaaS-Grade Dashboard Enhancements */
.btn-dash-admin {
    background: #7c3aed;
    color: #ffffff;
    border: none;
    font-size: 13px;
    font-weight: 700;
    padding: 7px 14px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.3);
    transition: all 0.15s;
}

.btn-dash-admin:hover {
    background: #6d28d9;
    transform: translateY(-1px);
}

.btn-dash-settings {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-dash-settings:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* Category Filter Bar & View Toggle */
.dashboard-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.tag-filter-pills {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tag-pill {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s;
}

.tag-pill:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.tag-pill.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.view-mode-toggle {
    display: flex;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 3px;
}

.btn-view-toggle {
    background: none;
    border: none;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-view-toggle.active {
    background: #eff6ff;
    color: #2563eb;
}

/* Table View Styles */
.projects-table-wrapper {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow-x: auto;
    margin-bottom: 30px;
}

.projects-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    text-align: left;
}

.projects-table th {
    background: #f8fafc;
    padding: 12px 16px;
    font-weight: 600;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.projects-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.projects-table tr:hover td {
    background: #f8fafc;
}

.table-proj-title {
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
}

.table-proj-title:hover {
    color: #2563eb;
    text-decoration: underline;
}

.badge-expr-count {
    background: #f1f5f9;
    color: #475569;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
}

.table-time {
    color: #64748b;
    font-size: 12.5px;
}

/* Favorite Star Buttons */
.btn-card-fav, .btn-star-fav {
    background: none;
    border: none;
    font-size: 18px;
    color: #cbd5e1;
    cursor: pointer;
    padding: 2px 4px;
    transition: transform 0.15s, color 0.15s;
    line-height: 1;
}

.btn-card-fav {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-card-fav:hover, .btn-star-fav:hover {
    transform: scale(1.2);
    color: #f59e0b;
}

.btn-card-fav.active, .btn-star-fav.active {
    color: #f59e0b;
}

.project-card.card-favorite {
    border-color: #fde68a;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.08);
}

/* Tags in cards and table */
.card-tags-row, .table-tags-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 6px 0;
}

.badge-tag {
    background: #e0f2fe;
    color: #0369a1;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.btn-add-tag {
    background: none;
    border: 1px dashed #cbd5e1;
    color: #64748b;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-add-tag:hover {
    border-color: #2563eb;
    color: #2563eb;
}

/* Settings Modal */
.dash-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.dash-modal-backdrop.hidden {
    display: none !important;
}

.dash-modal-box {
    background: #ffffff;
    border-radius: 14px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dash-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dash-modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: #0f172a;
}

.dash-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #64748b;
    cursor: pointer;
}

.dash-modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dash-modal-input, .dash-modal-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    color: #0f172a;
    outline: none;
    box-sizing: border-box;
}

.dash-modal-input:focus, .dash-modal-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

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

.dash-modal-footer {
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.settings-status-msg {
    font-size: 13px;
    color: #dc2626;
    min-height: 18px;
}

