* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-sidebar: #0f172a;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-inverse: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: var(--text-inverse);
    padding: 24px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.logo {
    padding: 0 24px 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 24px;
}

.logo h2 {
    font-size: 20px;
    font-weight: 600;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 14px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-inverse);
}

.nav-item.active {
    background: var(--primary);
    color: var(--text-inverse);
}

.nav-item .icon {
    font-size: 20px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
}

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

.header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-full {
    width: 100%;
}

/* Content Sections */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-left: 3px solid var(--primary);
}

.stat-icon {
    width: 56px;
    height: 56px;
    background: var(--bg-secondary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stat-info h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Card */
.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

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

.card-header h3 {
    margin-bottom: 0;
}

/* Status List */
.status-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    background: var(--bg-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--secondary);
}

.status-item.success .status-dot {
    background: var(--success);
}

.status-item.warning .status-dot {
    background: var(--warning);
}

.status-item.error .status-dot {
    background: var(--danger);
}

/* Table */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 16px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: var(--bg-secondary);
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 48px !important;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-blue {
    background: #dbeafe;
    color: #1e40af;
}

.badge-green {
    background: #d1fae5;
    color: #065f46;
}

/* Profiles Grid */
.profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.profile-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s;
}

.profile-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

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

.profile-header h4 {
    font-size: 16px;
    font-weight: 600;
}

.profile-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.profile-actions {
    display: flex;
    gap: 8px;
}

/* Operations */
.operations-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.operation-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.code-output {
    background: var(--bg-sidebar);
    color: #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    max-height: 400px;
    overflow-y: auto;
}

.code-output pre {
    margin: 0;
}

/* Logs */
.logs-container {
    max-height: 500px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-entry {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 6px;
    background: var(--bg-secondary);
    font-size: 14px;
    font-family: 'Courier New', monospace;
}

.log-time {
    color: var(--text-secondary);
    min-width: 80px;
}

.log-level {
    font-weight: 600;
    min-width: 60px;
}

.log-entry.info .log-level {
    color: var(--primary);
}

.log-entry.success .log-level {
    color: var(--success);
}

.log-entry.warning .log-level {
    color: var(--warning);
}

.log-entry.error .log-level {
    color: var(--danger);
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(14, 165, 233, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 0.6s linear infinite;
}

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

/* Fade in animation */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

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

/* Pulse animation for status dots */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status-item.success .status-dot {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Notification toast */
.notification-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid var(--primary);
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-toast.success {
    border-left-color: var(--success);
}

.notification-toast.error {
    border-left-color: var(--danger);
}

.notification-toast.warning {
    border-left-color: var(--warning);
}

/* Responsive */
@media (max-width: 1024px) {
    .operations-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }

    .main-content {
        margin-left: 200px;
        padding: 20px;
    }

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

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}

@media (max-width: 640px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
    }

    .main-content {
        margin-left: 0;
    }
}

/* Coding Profiles */
.card-header-actions {
    display: flex;
    gap: 8px;
}

.profile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 16px;
}

.tag {
    display: inline-block;
    padding: 3px 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    border-radius: 12px;
    border: 1px solid var(--border);
    letter-spacing: 0.02em;
}

.badge-neutral {
    background: #e2e8f0;
    color: #334155;
}

.empty-state-card {
    grid-column: 1 / -1;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px dashed var(--border);
    border-radius: 10px;
    font-size: 14px;
}

.empty-state-card.error {
    color: var(--danger);
    border-color: #fecaca;
    background: #fef2f2;
}

/* Profile Modal */
body.modal-open {
    overflow: hidden;
}

.profile-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.profile-modal[hidden] {
    display: none;
}

.profile-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}

.profile-modal-content {
    position: relative;
    background: var(--bg-primary);
    width: min(720px, 100%);
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: fadeInUp 0.25s ease;
}

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

.profile-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.profile-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.profile-modal-subtitle {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0 6px;
    transition: color 0.15s;
}

.btn-icon:hover {
    color: var(--text-primary);
}

.profile-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
}

.profile-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.profile-meta > div {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
}

.meta-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.profile-section-heading {
    margin: 20px 0 8px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.code-block {
    background: #0f172a;
    color: #e2e8f0;
    padding: 12px 14px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.5;
    max-height: 240px;
    overflow-y: auto;
}

.profile-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

@media (max-width: 640px) {
    .profile-meta {
        grid-template-columns: 1fr;
    }
}

/* Downloads Section */
.section-lead {
    color: var(--text-secondary);
    margin: -6px 0 20px;
    font-size: 14px;
}

.version-pill {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary);
    color: var(--text-inverse);
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.downloads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.download-card {
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.download-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.download-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--primary);
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 14px;
    letter-spacing: 0.04em;
}

.download-body h4 {
    margin: 0 0 6px;
    font-size: 15px;
    color: var(--text-primary);
}

.download-body p {
    margin: 0 0 10px;
    color: var(--text-secondary);
    font-size: 13px;
}

.inline-code {
    display: block;
    padding: 8px 10px;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 6px;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 12px;
    margin-bottom: 14px;
    overflow-x: auto;
    white-space: nowrap;
}

.download-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.download-size {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

.install-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.install-steps {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.install-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.step-number {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.install-step h5 {
    margin: 4px 0 8px;
    font-size: 14px;
    color: var(--text-primary);
}

.install-step .code-block {
    max-height: none;
}

.downloads-log {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.download-log-row {
    display: grid;
    grid-template-columns: 90px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
}

.download-log-kind {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--primary);
}

.download-log-name code {
    background: transparent;
    padding: 0;
}

.download-log-time {
    color: var(--text-secondary);
    font-size: 12px;
}
