/* VastGrace Document Portal Styles */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px 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);
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Screen Layout */
.screen {
    min-height: 100vh;
}

/* Login Screen */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-container {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.logo {
    margin-bottom: 10px;
}

.logo svg {
    width: 48px;
    height: 48px;
    color: var(--primary-color);
    margin-bottom: 16px;
}

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

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 16px;
}

.form-group {
    margin-bottom: 16px;
    text-align: left;
}

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

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

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

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

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

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

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

.btn-danger:hover {
    background-color: var(--danger-hover);
}

.btn-text {
    background: none;
    color: var(--text-secondary);
    padding: 4px 8px;
}

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

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left h1 {
    font-size: 20px;
    font-weight: 600;
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--primary-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-right svg {
    width: 18px;
    height: 18px;
}

/* Main Layout */
.main-content {
    display: flex;
    max-width: 1600px;
    margin: 0 auto;
    min-height: calc(100vh - 65px);
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    flex-shrink: 0;
}

.nav-menu {
    margin-bottom: 24px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 4px;
    transition: all 0.2s;
}

.nav-item:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    font-weight: 500;
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

.nav-section {
    margin-top: 24px;
}

.nav-section h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding-left: 12px;
}

.file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    color: white;
}

.file-icon.pdf { background: #ef4444; }
.file-icon.docx { background: #3b82f6; }
.file-icon.txt { background: #6b7280; }
.file-icon.md { background: #10b981; }

.stats-card {
    background: var(--bg-color);
    border-radius: var(--radius);
    padding: 16px;
}

.stats-card h4 {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.stats-card p {
    font-size: 14px;
    margin-bottom: 8px;
}

.stats-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* Search Bar */
.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.search-bar svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    background: transparent;
}

/* Drop Zone */
.drop-zone {
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    margin-bottom: 24px;
    transition: all 0.2s;
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.02);
}

.drop-zone-content svg {
    width: 48px;
    height: 48px;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.drop-zone-content p {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.drop-zone-content .file-types {
    font-size: 13px;
    color: var(--text-secondary);
}

.drop-zone input[type="file"] {
    display: none;
}

/* Upload Progress */
.upload-progress {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

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

.progress-bar {
    height: 4px;
    background: var(--bg-color);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s;
}

.progress-files {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Documents Container */
.documents-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

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

.documents-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.documents-header span {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Document List */
.document-list {
    padding: 8px 0;
}

.document-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.document-item:last-child {
    border-bottom: none;
}

.document-item:hover {
    background: var(--bg-color);
}

.document-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.document-icon.pdf { background: #ef4444; }
.document-icon.docx { background: #3b82f6; }
.document-icon.txt { background: #6b7280; }
.document-icon.md { background: #10b981; }

.document-info {
    flex: 1;
    min-width: 0;
}

.document-name {
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-meta {
    font-size: 13px;
    color: var(--text-secondary);
}

.document-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag {
    font-size: 11px;
    padding: 2px 8px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    border-radius: 12px;
}

.document-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.document-item:hover .document-actions {
    opacity: 1;
}

.document-actions button {
    padding: 6px 10px;
    font-size: 12px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 24px;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--border-color);
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
}

.empty-state span {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.modal-large {
    max-width: 900px;
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.preview-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.preview-header-info span {
    font-size: 13px;
    color: var(--text-secondary);
}

.preview-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.preview-actions button svg {
    width: 16px;
    height: 16px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: 60vh;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* Modal Drop Zone */
.modal-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-drop-zone:hover {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.02);
}

.modal-drop-zone svg {
    width: 40px;
    height: 40px;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.modal-drop-zone p {
    color: var(--text-secondary);
    font-size: 14px;
}

.modal-drop-zone input {
    display: none;
}

/* Selected Files */
.selected-files {
    margin-bottom: 20px;
}

.selected-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: var(--bg-color);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.selected-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.selected-file-name {
    font-size: 14px;
    font-weight: 500;
}

.selected-file-size {
    font-size: 12px;
    color: var(--text-secondary);
}

.remove-file {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

.remove-file:hover {
    color: var(--danger-color);
}

/* Preview Content */
.preview-content {
    background: var(--bg-color);
    border-radius: var(--radius);
    padding: 20px;
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.preview-content .loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
}

.toast {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    min-width: 300px;
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-section {
        display: none;
    }
    
    .document-actions {
        opacity: 1;
    }
    
    .modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
}

@media (max-width: 480px) {
    .header {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .documents-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .document-item {
        flex-wrap: wrap;
    }
    
    .document-tags {
        width: 100%;
        margin-top: 8px;
    }
}