/* ===== INDEX.PHP CUSTOM STYLES ===== */

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

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 100%;
}

.login-logo {
    text-align: center;
    margin-bottom: 20px;
}

.login-logo i {
    font-size: 64px;
    color: #3498db;
}

.login-box h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 28px;
}

.login-subtitle {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 30px;
    font-size: 14px;
}

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

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

.form-group label i {
    color: #3498db;
    margin-right: 5px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
}

.error-message {
    background: #fee;
    color: #e74c3c;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 13px;
    text-align: center;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-primary:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

/* Header */
.header {
    background: white;
    border-bottom: 2px solid #e0e0e0;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo {
    height: 40px;
    width: auto;
}

.header-title {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
}

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

.header-greeting {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-datetime {
    font-size: 12px;
    color: #7f8c8d;
}

.logout-link {
    color: #e74c3c;
    font-size: 20px;
    text-decoration: none;
    transition: all 0.2s;
    padding: 8px;
    border-radius: 4px;
}

.logout-link:hover {
    background: #fee;
    transform: scale(1.1);
}

/* Container */
.container {
    display: flex;
    height: calc(100vh - 72px);
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 175px;
    min-width: 175px;
    max-width: 500px;
    background: white;
    border-right: 2px solid #e0e0e0;
    overflow-y: auto;
    position: relative;
    flex-shrink: 0;
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-left: 1px solid #e0e0e0;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 4px;
    transition: background 0.2s;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

.sidebar::-webkit-scrollbar-thumb:active {
    background: #7f8c8d;
}

/* Resize handle for sidebar - positioned outside scrollbar */
.sidebar-resize-handle {
    position: absolute;
    top: 0;
    left: 175px;
    width: 6px;
    height: 100%;
    cursor: ew-resize;
    background: transparent;
    z-index: 10;
    transition: background 0.2s;
    pointer-events: auto;
}

.sidebar-resize-handle:hover {
    background: rgba(52, 152, 219, 0.5);
}

.sidebar-resize-handle.resizing {
    background: #3498db;
}

.folder {
    padding: 6px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
    user-select: none;
}

.folder:hover {
    background: #f8f9fa;
}

.folder.expanded {
    background: #e8f4f8;
}

.folder-icon::before {
    content: '\f07b';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: #d2d2d7;
    margin-right: 3px;
    font-size: 11px;
    opacity: 0.6;
}

.folder.expanded .folder-icon::before {
    content: '\f07c';
}

/* Folder with analyzed documents gets normal color */
.folder.has-analyzed .folder-icon::before {
    color: #f39c12;
    opacity: 1;
}

.folder-name {
    font-size: 11px;
    color: #2c3e50;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.folder-contents {
    background: #fafafa;
}

.document {
    padding: 5px 10px;
    font-size: 11px;
    color: #2c3e50;
    transition: background 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document:hover {
    background: #e8f4f8;
}

.document::before {
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-right: 3px;
    font-size: 10px;
    flex-shrink: 0;
    opacity: 0.4;
}

.document.pdf::before {
    content: '\f1c1';
    color: #d2d2d7;
}

.document.docx::before {
    content: '\f1c2';
    color: #d2d2d7;
}

.document.excel::before {
    content: '\f1c3';
    color: #d2d2d7;
}

.document.ppt::before {
    content: '\f1c4';
    color: #d2d2d7;
}

.document.txt::before {
    content: '\f15c';
    color: #d2d2d7;
}

/* Analyzed documents get normal colors */
.document.analyzed.pdf::before {
    content: '\f1c1';
    color: #e74c3c;
    opacity: 1;
}

.document.analyzed.docx::before {
    content: '\f1c2';
    color: #3498db;
    opacity: 1;
}

.document.analyzed.excel::before {
    content: '\f1c3';
    color: #27ae60;
    opacity: 1;
}

.document.analyzed.ppt::before {
    content: '\f1c4';
    color: #e67e22;
    opacity: 1;
}

.document.analyzed.txt::before {
    content: '\f15c';
    color: #95a5a6;
    opacity: 1;
}

.sidebar-footer {
    border-top: 1px solid #e0e0e0;
    margin-top: 20px;
}

/* Connection Service Buttons */
.connect-service-btn {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: white;
    padding: 14px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.connect-service-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.connect-gdrive-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #e74c3c;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.connect-gdrive-btn:hover {
    background: #c0392b;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

/* Main Content */
.main-content {
    flex: 1;
    background: #f8f9fa;
    overflow: hidden;
    position: relative;
}

/* Main Content Box - 100% container for all views */
.main-content-box {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom scrollbar for main content */
.main-content-box::-webkit-scrollbar {
    width: 10px;
}

.main-content-box::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.main-content-box::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 5px;
    transition: background 0.2s;
}

.main-content-box::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

.main-content-box::-webkit-scrollbar-thumb:active {
    background: #7f8c8d;
}

.welcome-container {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 80px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
}

.welcome-icon {
    font-size: 96px;
    color: #3498db;
    margin-bottom: 30px;
}

.welcome-container h2 {
    color: #2c3e50;
    font-size: 32px;
    margin-bottom: 15px;
}

.welcome-container p {
    color: #7f8c8d;
    font-size: 16px;
    margin-bottom: 40px;
}

.connection-options {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 40px;
}

.connect-option {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 30px;
    width: 280px;
    text-decoration: none;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.connect-option:hover {
    border-color: #3498db;
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(52, 152, 219, 0.2);
}

.connect-option.google:hover {
    border-color: #4285f4;
    box-shadow: 0 8px 24px rgba(66, 133, 244, 0.2);
}

.connect-option.microsoft:hover {
    border-color: #0078d4;
    box-shadow: 0 8px 24px rgba(0, 120, 212, 0.2);
}

.connect-option-icon {
    font-size: 64px;
}

.connect-option.google .connect-option-icon {
    color: #4285f4;
}

.connect-option.microsoft .connect-option-icon {
    color: #0078d4;
}

.connect-option-text h3 {
    color: #2c3e50;
    font-size: 20px;
    margin: 0 0 10px 0;
}

.connect-option-text p {
    color: #7f8c8d;
    font-size: 14px;
    margin: 0;
}

.connected-info {
    margin-top: 40px;
}

.connected-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #d4edda;
    color: #27ae60;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
}

.connected-badge i {
    font-size: 20px;
}

/* ===== DOCUMENT ANALYSIS POPUP ===== */

/* Analysis Popup Overlay */
.analysis-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Analysis Popup */
.analysis-popup {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.4s ease;
}

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

/* Analysis Popup Header */
.analysis-popup-header {
    padding: 24px 30px;
    border-bottom: 2px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.analysis-popup-header i {
    font-size: 32px;
    color: #3498db;
    margin-bottom: 8px;
}

.analysis-popup-header h3 {
    margin: 0;
    font-size: 24px;
    color: #2c3e50;
    font-weight: 600;
}

.analysis-doc-name {
    font-size: 14px;
    color: #7f8c8d;
    font-weight: 400;
    margin: 0;
}

/* Analysis Popup Body */
.analysis-popup-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

/* Analysis Progress Section */
.analysis-progress-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.analysis-step {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #e0e0e0;
    transition: all 0.3s;
}

.analysis-step.active {
    background: #e3f2fd;
    border-left-color: #3498db;
}

.analysis-step.complete {
    background: #d4edda;
    border-left-color: #27ae60;
}

.analysis-step.error {
    background: #ffe0e0;
    border-left-color: #e74c3c;
}

.step-icon {
    font-size: 20px;
    color: #95a5a6;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.analysis-step.active .step-icon {
    color: #3498db;
}

.analysis-step.complete .step-icon {
    color: #27ae60;
}

.analysis-step.error .step-icon {
    color: #e74c3c;
}

.step-content {
    flex: 1;
}

.step-title {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.step-status {
    font-size: 12px;
    color: #7f8c8d;
}

/* Progress Bar */
.analysis-progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 24px;
}

.analysis-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db 0%, #2ecc71 100%);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 4px;
}

/* AI Response Container */
.analysis-response-container {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.analysis-response-header {
    background: #f8f9fa;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.analysis-response-content {
    padding: 16px;
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
    background: white;
}

/* Custom scrollbar for response content */
.analysis-response-content::-webkit-scrollbar {
    width: 8px;
}

.analysis-response-content::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.analysis-response-content::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 4px;
}

.analysis-response-content::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

.analysis-waiting {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #95a5a6;
    font-size: 14px;
    font-style: italic;
    min-height: 200px;
}

.analysis-waiting i {
    font-size: 20px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.analysis-response-text {
    font-size: 14px;
    line-height: 1.6;
    color: #2c3e50;
    opacity: 0.75;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Analysis Popup Footer */
.analysis-popup-footer {
    padding: 20px 30px;
    border-top: 2px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.analysis-status-text {
    font-size: 14px;
    color: #7f8c8d;
    font-style: italic;
}

.analysis-complete {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #27ae60;
    font-weight: 600;
}

.analysis-complete i {
    font-size: 20px;
}

.analysis-error {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #e74c3c;
    font-weight: 600;
}

.analysis-error i {
    font-size: 20px;
}

.analysis-close-btn {
    padding: 10px 24px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.analysis-close-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.analysis-close-btn.error {
    background: #e74c3c;
}

.analysis-close-btn.error:hover {
    background: #c0392b;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-left,
    .header-right {
        justify-content: center;
    }
    
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 300px;
    }
    
    .connection-options {
        flex-direction: column;
        align-items: center;
    }
    
    .connect-option {
        width: 100%;
        max-width: 350px;
    }
    
    .analysis-popup {
        margin: 10px;
        max-height: 95vh;
    }
    
    .analysis-popup-header {
        padding: 20px;
    }
    
    .analysis-popup-body {
        padding: 20px;
    }
    
    .analysis-popup-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .analysis-close-btn {
        width: 100%;
        justify-content: center;
    }
}

