.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
}

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

.app-icon {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.view-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.btn-settings {
    width: 32px;
    height: 32px;
    font-size: 20px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

    .btn-settings:hover {
        background: var(--bg-secondary);
        border-color: var(--border);
        /*transform: rotate(90deg);*/
    }


/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors */
    --primary: #0078d4;
    --primary-hover: #106ebe;
    --secondary: #50e6ff;
    --success: #107c10;
    --warning: #ffaa44;
    --error: #d13438;
    --text-primary: #323130;
    --text-secondary: #605e5c;
    --text-disabled: #a19f9d;
    --bg-primary: #ffffff;
    --bg-secondary: #f3f2f1;
    --bg-tertiary: #faf9f8;
    --border: #edebe9;
    --border-hover: #d2d0ce;
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    /* Typography */
    --font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-xs: 11px;
    --font-size-sm: 12px;
    --font-size-md: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 20px;
    /* Borders */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-md);
    color: var(--text-primary);
    background: var(--bg-secondary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== REFRESH ANIMATION ===== */
@keyframes contentRefresh {
    0% {
        opacity: 0.5;
        transform: scale(0.98);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.content-refreshing {
    animation: contentRefresh 0.3s ease;
}

/* ===== APP CONTAINER ===== */
.app-container {
    width: 100%;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 {
    font-size: var(--font-size-xl);
}

h2 {
    font-size: var(--font-size-lg);
}

h3 {
    font-size: var(--font-size-md);
    font-weight: 600;
}

.text-secondary {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.text-disabled {
    color: var(--text-disabled);
}

/* ===== BUTTONS ===== */
button {
    font-family: var(--font-family);
    font-size: var(--font-size-md);
    font-weight: 600;
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
    white-space: nowrap;
}

    button:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

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

    .btn-primary:hover:not(:disabled) {
        background: var(--primary-hover);
    }

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

    .btn-secondary:hover:not(:disabled) {
        background: var(--bg-secondary);
        border-color: var(--border-hover);
    }

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

.btn-icon {
    background: transparent;
    color: var(--text-secondary);
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

    .btn-icon:hover:not(:disabled) {
        background: var(--bg-secondary);
        color: var(--text-primary);
    }

.btn-block {
    width: 100%;
}

/* ===== COLLAPSIBLE ===== */
.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    padding: var(--space-sm) 0;
}

    .collapsible-header:hover {
        opacity: 0.8;
    }

    .collapsible-header label {
        margin: 0;
        cursor: pointer;
        font-weight: 600;
        font-size: var(--font-size-sm);
        color: var(--text-primary);
        flex: 1;
    }

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

    .collapsible-content.expanded {
        max-height: 500px; /* Large enough for any content */
    }

.collapsible-body {
    padding-top: var(--space-sm);
}

.toggle-icon {
    font-size: 12px;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
    user-select: none;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

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

.card-header {
    cursor: pointer;
    user-select: none;
}

    .card-header:hover .toggle-icon {
        color: var(--primary);
    }


/* Model preview shown when collapsed */
.model-preview-inline {
    font-weight: normal;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-left: var(--space-sm);
}

/* Card header adjustments for collapsibles */
.card.compact .collapsible-header {
    padding: 0;
}


/* ===== INPUTS ===== */
input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
    font-family: var(--font-family);
    font-size: var(--font-size-md);
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    width: 100%;
    transition: border-color var(--transition-fast);
}

    input:focus,
    select:focus,
    textarea:focus {
        outline: none;
        border-color: var(--primary);
    }

textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

input[type="checkbox"] {
    width: auto;
    margin-right: var(--space-sm);
}

/* ===== FORM GROUPS ===== */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.form-hint {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: var(--space-md); 
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

    .card.compact {
        padding: var(--space-sm) var(--space-md);
        margin-bottom: var(--space-sm);
    }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm); 
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    color: var(--text-primary);
}

/* Reduce spacing in main view */
.view-body > .card {
    margin-bottom: var(--space-sm); /* Reduced spacing between cards */
}

/* ===== STATUS/ALERTS ===== */
.status {
    position: fixed; /* Changed from relative to fixed */
    top: 60px; /* Below the header */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000; /* Above other content */
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 90%;
    text-align: center;
    animation: slideDown 0.3s ease-out;
    pointer-events: none; /* Don't block clicks */
}

/* Slide down animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Status types */
.status.info {
    background-color: var(--info-bg, #e3f2fd);
    color: var(--info-text, #1976d2);
    border: 1px solid var(--info-border, #90caf9);
}

.status.success {
    background-color: var(--success-bg, #e8f5e9);
    color: var(--success-text, #2e7d32);
    border: 1px solid var(--success-border, #81c784);
}

.status.error {
    background-color: var(--error-bg, #ffebee);
    color: var(--error-text, #c62828);
    border: 1px solid var(--error-border, #ef5350);
}

.status.warning {
    background-color: var(--warning-bg, #fff3e0);
    color: var(--warning-text, #e65100);
    border: 1px solid var(--warning-border, #ffb74d);
}

/* Fade out animation (when hiding) */
.status.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
}

/* ===== UTILITIES ===== */
.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-sm {
    gap: var(--space-sm);
}

.gap-md {
    gap: var(--space-md);
}

.gap-lg {
    gap: var(--space-lg);
}

.mt-sm {
    margin-top: var(--space-sm);
}

.mt-md {
    margin-top: var(--space-md);
}

.mt-lg {
    margin-top: var(--space-lg);
}

.mb-sm {
    margin-bottom: var(--space-sm);
}

.mb-md {
    margin-bottom: var(--space-md);
}

.mb-lg {
    margin-bottom: var(--space-lg);
}

.p-sm {
    padding: var(--space-sm);
}

.p-md {
    padding: var(--space-md);
}

.p-lg {
    padding: var(--space-lg);
}

.text-center {
    text-align: center;
}

.w-full {
    width: 100%;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 4px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--text-disabled);
    }
