/* ============================================
   History Charts — Dashboard Styles
   ============================================ */

/* Navbar */
.dash-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 2rem;
    border-bottom: 1px solid var(--border-subtle);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: var(--text-primary);
}

.nav-logo .logo-icon {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.6);
}

.nav-logo .logo-text {
    font-size: var(--font-lg);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-weight: 700;
    font-size: var(--font-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.user-avatar:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.15);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-sm);
    animation: fadeIn 0.2s ease-out;
}

.dropdown-header {
    padding: var(--space-sm) var(--space-md);
}

.dropdown-name {
    font-weight: 600;
    font-size: var(--font-sm);
}

.dropdown-email {
    font-size: var(--font-xs);
    color: var(--text-muted);
    word-break: break-all;
}

.dropdown-divider {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: var(--space-xs) 0;
}

.dropdown-item {
    width: 100%;
    padding: 0.5rem var(--space-md);
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--font-sm);
    text-align: left;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* Main */
.dash-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-xl);
}

/* Toolbar */
.dash-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.search-input {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.search-input:focus {
    border-color: rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04) !important;
}

/* Filter pills */
.filter-group {
    display: flex;
    gap: 2px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 3px;
}

.filter-btn {
    padding: 0.45rem 1rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
    background: transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-btn:hover {
    color: rgba(255, 255, 255, 0.7);
}

.filter-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-weight: 600;
}

.dash-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
    gap: var(--space-md);
    flex-wrap: wrap;
}

.dash-header h1 {
    font-size: var(--font-2xl);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.text-secondary {
    color: var(--text-secondary);
    font-size: var(--font-sm);
    margin-top: 4px;
}

/* Color Picker */
.color-picker-wrap {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.color-picker {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-subtle);
    cursor: pointer;
    padding: 0;
    background: transparent;
    transition: border-color var(--transition-fast);
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 3px;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.color-picker::-moz-color-swatch {
    border: none;
    border-radius: 6px;
}

.color-picker:hover {
    border-color: var(--border-hover);
}

.color-value {
    font-family: monospace;
    font-size: var(--font-sm);
    color: var(--text-muted);
    text-transform: uppercase;
}

.profile-error {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--color-red);
    font-size: var(--font-sm);
    margin-bottom: var(--space-md);
}

.profile-success {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--color-green);
    font-size: var(--font-sm);
    margin-bottom: var(--space-md);
}

/* Flowchart Grid */
.flowchart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

/* Flowchart Card */
.fc-card {
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
    animation: fadeInUp 0.4s ease-out both;
    text-decoration: none;
    color: inherit;
    display: block;
}

.fc-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-4px);
}

/* Glowing border effect on hover */
.fc-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 21px;
    padding: 1px;
    background: conic-gradient(from var(--glow-angle, 180deg),
            transparent 0%,
            rgba(255, 255, 255, 0.15) 10%,
            rgba(255, 255, 255, 0.4) 20%,
            rgba(255, 255, 255, 0.15) 30%,
            transparent 40%,
            transparent 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.fc-card:hover::before {
    opacity: 1;
    animation: glowRotate 3s linear infinite;
}

@keyframes glowRotate {
    from {
        --glow-angle: 0deg;
    }

    to {
        --glow-angle: 360deg;
    }
}

@property --glow-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* Card preview area */
.fc-card-preview {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.fc-card-preview-bg {
    font-size: 2.5rem;
    opacity: 0.15;
}

/* Thumbnail image */
.fc-card-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 19px 19px 0 0;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.fc-card:hover .fc-card-thumbnail {
    opacity: 1;
}

/* Generating state */
.fc-card-generating {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 100%;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
}

.fc-card-generating .spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.fc-card-status {
    position: absolute;
    top: 10px;
    right: 10px;
}

/* Card body */
.fc-card-body {
    padding: 1.25rem;
}

.fc-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.35rem;
}

.fc-card-date {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 0.5rem;
}

.fc-card-desc {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.fc-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

/* Card animation delays */
.fc-card:nth-child(1) {
    animation-delay: 0s;
}

.fc-card:nth-child(2) {
    animation-delay: 0.05s;
}

.fc-card:nth-child(3) {
    animation-delay: 0.1s;
}

.fc-card:nth-child(4) {
    animation-delay: 0.15s;
}

.fc-card:nth-child(5) {
    animation-delay: 0.2s;
}

.fc-card:nth-child(6) {
    animation-delay: 0.25s;
}

/* Import Modal */
.import-dropzone {
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    min-height: 200px;
    position: relative;
    overflow: hidden;
}

.import-dropzone:hover,
.import-dropzone.dragover {
    border-color: var(--color-blue);
    background: rgba(59, 130, 246, 0.05);
}

.import-dropzone.dragover {
    transform: scale(1.01);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.1);
}

.dropzone-content {
    text-align: center;
    pointer-events: none;
}

.import-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-md);
    object-fit: contain;
}

.import-progress {
    margin-top: var(--space-lg);
}

.import-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-canvas);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-sm);
}

.import-progress-fill {
    height: 100%;
    width: 0%;
    background: #fff;
    border-radius: var(--radius-full);
    transition: width 0.5s ease-out;
}

.import-status {
    font-size: var(--font-sm);
    color: var(--text-muted);
    text-align: center;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Responsive */
@media (max-width: 768px) {
    .dash-nav {
        padding: 0.75rem 1rem;
    }

    .dash-main {
        padding: var(--space-lg) var(--space-md);
    }

    .dash-header {
        flex-direction: column;
    }

    .flowchart-grid {
        grid-template-columns: 1fr;
    }
}