/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Spacing system */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-md: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    
    /* Line heights */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    
    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
    
    /* Z-index scale */
    --z-dropdown: 1000;
    --z-modal: 1050;
    --z-toast: 1100;
}

html {
    font-size: 16px;
    line-height: var(--line-height-normal);
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-md);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

/* App Layout */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

.app__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    height: 64px;
}

.app__main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Header */
.header__left {
    flex: 0 0 auto;
}

.header__title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
}

.header__center {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 400px;
    margin: 0 var(--space-lg);
}

.header__right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Search */
.search-container {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: var(--space-sm) var(--space-xl) var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-color-alpha);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-clear {
    position: absolute;
    right: var(--space-sm);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.search-clear:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

/* Sidebar */
.sidebar {
    width: 30%;
    min-width: 280px;
    max-width: 500px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar__header {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.sidebar__content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sidebar__footer {
    padding: var(--space-md);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
}

/* Content Area */
.content {
    flex: 1;
    background-color: var(--bg-primary);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.content__area {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
}

.welcome-screen__content {
    text-align: center;
    max-width: 400px;
}

.welcome-screen__icon {
    color: var(--accent-color);
    margin-bottom: var(--space-lg);
}

.welcome-screen h2 {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.welcome-screen p {
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
    line-height: var(--line-height-relaxed);
}

.welcome-screen__actions {
    display: flex;
    justify-content: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app__header {
        flex-direction: column;
        height: auto;
        padding: var(--space-sm);
        gap: var(--space-sm);
    }
    
    .header__center {
        order: -1;
        margin: 0;
        max-width: none;
    }
    
    .header__left,
    .header__right {
        flex: 1;
    }
    
    .header__right {
        justify-content: flex-end;
    }
    
    .app__main {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-width: none;
        height: 40%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .content {
        height: 60%;
    }
}

@media (max-width: 480px) {
    .app__header {
        padding: var(--space-sm);
    }
    
    .header__title {
        font-size: var(--font-size-lg);
    }
    
    .sidebar__header {
        flex-direction: column;
    }
    
    .sidebar__footer {
        flex-direction: column;
    }
    
    .welcome-screen {
        padding: var(--space-lg);
    }
    
    .welcome-screen h2 {
        font-size: var(--font-size-xl);
    }
}

/* Utility Classes */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

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

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

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* Focus Styles */
*:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-color-alpha);
}

/* Selection Styles */
::selection {
    background-color: var(--accent-color-alpha);
    color: var(--text-primary);
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-sm);
}

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

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-secondary);
}

