:root {
    --primary-color: #1976d2;
    --primary-light: #42a5f5;
    --primary-dark: #1565c0;
    --secondary-color: #9c27b0;
    --background-default: #f5f5f5;
    --surface-color: #ffffff;
    --text-primary: #1c1c1c;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --sidebar-width: 260px;
    --header-height: 64px;
    --transition-speed: 0.3s;
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: 1px solid rgba(255, 255, 255, 0.2);
    --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);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-default);
    color: var(--text-primary);
    overflow: hidden;
    /* App-like feel */
}

/* Layout */
.app-layout {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-speed) ease;
    z-index: 20;
}

.sidebar.collapsed {
    width: 72px;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    justify-content: space-between;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
    white-space: nowrap;
}

.logo-img {
    height: 32px;
    width: auto;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
}

.toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.nav-list {
    list-style: none;
    padding: 16px 8px;
    flex: 1;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: all 0.2s ease;
    gap: 16px;
    white-space: nowrap;
    overflow: hidden;
}

.nav-link:hover {
    background-color: rgba(25, 118, 210, 0.08);
    color: var(--primary-color);
}

.nav-link.active {
    background-color: rgba(25, 118, 210, 0.12);
    color: var(--primary-color);
    font-weight: 500;
}

.nav-icon {
    font-family: 'Material Icons';
    font-size: 24px;
    min-width: 24px;
}

/* Main Content */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.app-bar {
    height: var(--header-height);
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.app-bar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 50%;
    display: flex;
}

.icon-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    background-color: #f8fafc;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Typography */
h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 8px;
}

h2 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 24px;
    color: var(--primary-color);
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* Cards and Paper */
.paper {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

/* File Upload Box */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.upload-card {
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
    position: relative;
}

.upload-card:hover {
    border-color: var(--primary-color);
    background: rgba(25, 118, 210, 0.04);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.upload-card.has-file {
    border-style: solid;
    border-color: var(--primary-light);
    background: #e3f2fd;
}

.upload-card input[type="file"] {
    display: none;
}

.upload-icon {
    font-size: 48px;
    color: #999;
    margin-bottom: 16px;
}

.upload-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.upload-label {
    font-weight: 600;
    color: var(--primary-color);
    display: block;
    margin-bottom: 12px;
    font-size: 1rem;
}

.file-chip {
    background-color: var(--surface-color);
    border: 1px solid var(--primary-light);
    border-radius: 16px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    max-width: 100%;
}

.file-name {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

/* Controls */
.controls-area {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.form-control {
    min-width: 200px;
    position: relative;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

select.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background-color: var(--surface-color);
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%22//www.w3.org/2000/svg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px top 50%;
    background-size: 12px auto;
}

select.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 1rem;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background-color: #bdbdbd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    min-width: 300px;
    padding: 16px;
    border-radius: 8px;
    background: white;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left-color: #4caf50;
}

.toast.error {
    border-left-color: #f44336;
}

.toast.info {
    border-left-color: #2196f3;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* User Menu */
.user-menu-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-greeting {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    padding: 8px 0;
    display: none;
    border: 1px solid var(--border-color);
    z-index: 100;
}

.user-dropdown.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .file-grid {
        grid-template-columns: 1fr;
    }

    .controls-area {
        flex-direction: column;
        align-items: stretch;
    }

    .sidebar {
        position: absolute;
        height: 100%;
        transform: translateX(-100%);
        width: 240px;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    :root {
        --sidebar-width: 0px;
    }
}
