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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
    color: #333;
}

body:not(:has(.dashboard)) {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.app {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Authentication Container */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    width: 100%;
    max-width: 450px;
    animation: slideUp 0.4s ease-out;
}

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

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 8px;
}

.auth-header p {
    font-size: 14px;
    color: #718096;
}

/* Form Styles */
.auth-form {
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s;
    background: #f7fafc;
    color: #2d3748;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder {
    color: #a0aec0;
}

/* Button Styles */
.btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary::before {
    content: '⬆️';
    font-size: 18px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Error Message */
.error-message {
    background: #fed7d7;
    color: #c53030;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    border-left: 4px solid #c53030;
}

/* Success Message */
.success-message {
    background: #c6f6d5;
    color: #22543d;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    border-left: 4px solid #38a169;
}

/* Auth Footer */
.auth-footer {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.auth-footer p {
    font-size: 14px;
    color: #718096;
}

.auth-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.auth-footer a:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Dashboard Styles */
.dashboard {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 0;
}

.dashboard-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1a202c;
    margin: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info span {
    font-size: 14px;
    color: #4a5568;
}

.user-info strong {
    color: #1a202c;
    font-weight: 600;
}

.btn-logout {
    padding: 8px 16px;
    background: #e53e3e;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #c53030;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(229, 62, 62, 0.3);
}

.dashboard-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.dashboard-layout {
    display: flex;
    gap: 24px;
    align-items: start;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 24px;
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    flex-shrink: 0;
    animation: slideUp 0.4s ease-out 0.2s both;
}

.sidebar-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.sidebar-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1a202c;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-header h3::before {
    content: '📋';
    font-size: 20px;
}

.document-types-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.document-types-list li {
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.document-types-list li.loading,
.document-types-list li.empty,
.document-types-list li.error {
    color: #718096;
    font-size: 14px;
    cursor: default;
    justify-content: center;
    padding: 20px;
}

.document-types-list li.error {
    color: #e53e3e;
}

.document-type-item {
    background: #f7fafc;
    border: 2px solid transparent;
}

.document-type-item:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: translateX(4px);
}

.document-type-item.active {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
    color: #667eea;
    font-weight: 600;
}

.type-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.type-label {
    font-size: 14px;
    font-weight: 500;
    color: #2d3748;
}

.document-type-item.active .type-label {
    color: #667eea;
}

.dashboard-content {
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 32px;
    align-items: start;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Upload Section */
.upload-section {
    position: sticky;
    top: 100px;
}

.upload-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 32px;
    animation: slideUp 0.4s ease-out;
}

.upload-card h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.upload-card h2::before {
    content: '📤';
    font-size: 24px;
}

.upload-form {
    margin-top: 8px;
}

.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s;
    background: #f7fafc;
    color: #2d3748;
    font-family: inherit;
    resize: vertical;
}

.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea::placeholder {
    color: #a0aec0;
}

.form-group select {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s;
    background: #f7fafc;
    color: #2d3748;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234a5568' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.form-group select:focus {
    outline: none;
    border-color: #667eea;
    background-color: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* File Input Styling */
.file-input-wrapper {
    position: relative;
    display: block;
}

.file-input-wrapper .file-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.file-input-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 20px;
    font-size: 14px;
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    background: #f7fafc;
    cursor: pointer;
    transition: all 0.2s;
    color: #718096;
    text-align: center;
}

.file-input-label:hover {
    border-color: #667eea;
    background: #edf2f7;
    color: #667eea;
}

.file-input-wrapper .file-input:focus + .file-input-label {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.file-input-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.file-input-text {
    font-weight: 500;
}

.file-input-wrapper .file-input:valid + .file-input-label {
    border-color: #38a169;
    background: rgba(56, 161, 105, 0.05);
    color: #38a169;
}

.file-input-wrapper .file-input:valid + .file-input-label .file-input-text::after {
    content: ' ✓';
    margin-left: 8px;
}

/* Documents Section */
.documents-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 32px;
    animation: slideUp 0.4s ease-out 0.1s both;
}

.documents-section h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.documents-section h2::before {
    content: '📁';
    font-size: 24px;
}

.documents-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.document-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.2s;
    background: #f7fafc;
}

.document-card:hover {
    border-color: #667eea;
    background: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.document-icon {
    font-size: 32px;
    flex-shrink: 0;
}

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

.document-info h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 4px;
    word-wrap: break-word;
}

.document-info .description {
    font-size: 14px;
    color: #718096;
    margin-bottom: 8px;
    word-wrap: break-word;
}

.document-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: #a0aec0;
}

.document-meta span {
    padding: 4px 8px;
    background: white;
    border-radius: 4px;
    font-weight: 500;
}

.document-type {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1) !important;
}

.file-type {
    color: #38a169;
    background: rgba(56, 161, 105, 0.1) !important;
}

.document-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-download,
.btn-delete {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-download {
    background: #667eea;
    color: white;
}

.btn-download:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-delete {
    background: #fed7d7;
    color: #c53030;
}

.btn-delete:hover {
    background: #fc8181;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(229, 62, 62, 0.3);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 18px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
}

.empty-state span {
    font-size: 14px;
    color: #a0aec0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .dashboard-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: static;
        max-height: none;
    }
    
    .document-types-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 8px;
    }
    
    .document-types-list li {
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .upload-section {
        position: static;
    }
    
    .financial-data-card {
        padding: 20px;
    }
    
    .financial-table {
        font-size: 12px;
        min-width: 500px;
    }
    
    .financial-table th,
    .financial-table td {
        padding: 8px 12px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .user-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .document-card {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .document-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .document-types-list {
        grid-template-columns: 1fr;
    }
}

/* Financial Data Section */
.financial-data-section {
    margin-top: 32px;
    animation: slideUp 0.4s ease-out;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    grid-column: 1 / -1; /* Span all columns in grid */
}

.financial-data-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 32px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.financial-data-card h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.financial-data-card h2::before {
    content: '📊';
    font-size: 24px;
}

.loading-message {
    padding: 20px;
    text-align: center;
    color: #718096;
    font-size: 14px;
}

.financial-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    margin-top: 16px;
    font-size: 14px;
    table-layout: auto;
}

.financial-table thead {
    background: #f7fafc;
    position: sticky;
    top: 0;
    z-index: 10;
}

.financial-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #2d3748;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.financial-table th:first-child,
.financial-table td:first-child {
    position: sticky;
    left: 0;
    background: white;
    z-index: 5;
}

.financial-table thead th:first-child {
    background: #f7fafc;
}

.financial-table tbody tr {
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.2s;
}

.financial-table tbody tr:hover {
    background-color: #f7fafc;
}

.financial-table td {
    padding: 12px 16px;
    color: #2d3748;
    white-space: nowrap;
}

.financial-table td:first-child {
    font-weight: 600;
    color: #1a202c;
}

.financial-table td:last-child {
    font-weight: 600;
    background: #f0f4ff;
}

#financial-data-table-container {
    max-height: 600px;
    overflow-x: auto;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .auth-card {
        padding: 24px;
    }
    
    .auth-header h1 {
        font-size: 24px;
    }
    
    .dashboard-main {
        padding: 24px 16px;
    }
    
    .upload-card,
    .documents-section,
    .financial-data-card {
        padding: 24px;
    }
    
    .file-input-label {
        padding: 16px;
        flex-direction: column;
        gap: 8px;
    }
    
    .file-input-text {
        font-size: 12px;
    }
}

