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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #4285F4 0%, #9C27B0 50%, #FF5722 100%);
    min-height: 100vh;
    color: #2d3748;
    line-height: 1.6;
}

.container {
    max-width: 2400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 0;
    position: relative;
}

.header-actions {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.contact-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.contact-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.language-switcher {
    display: flex;
    gap: 8px;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    font-weight: 600;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
    flex-direction: row;
}

.gemini-logo {
    width: 32px;
    height: 32px;
    margin-right: 12px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 5px;
}

.powered-by {
    font-size: 0.9rem;
    color: #6b7280;
    margin-top: 5px;
    font-weight: 500;
}

.subtitle {
    font-size: 1.1rem;
    color: #e2e8f0;
    font-weight: 400;
    margin-top: 8px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 2rem 2rem 2rem;
    margin: -2rem auto 0 auto;
    max-width: 1200px;
}

/* Upload Section */
.upload-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.upload-area {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 2px dashed #c7d2fe;
    border-radius: 24px;
    padding: 60px 40px;
    text-align: center;
    max-width: 750px;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}

/* AI instruction input box styles */
.instruction-input {
    text-align: left;
    margin: 25px 0;
}

.instruction-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
    font-size: 14px;
}

.instruction-input textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
    background: white;
    color: #2d3748;
    transition: all 0.3s ease;
}

.instruction-input textarea::placeholder {
    color: #a0aec0;
}

.instruction-input textarea:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.upload-area:hover {
    border-color: #8b5cf6;
    transform: translateY(-5px);
    box-shadow: 0 25px 80px rgba(139, 92, 246, 0.2);
}

.upload-area.dragover {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.05);
}

.upload-icon {
    margin-bottom: 20px;
}

.upload-icon i {
    font-size: 4rem;
    color: #8b5cf6;
    opacity: 0.8;
}

.upload-area h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 10px;
}

.upload-area p {
    color: #64748b;
    margin-bottom: 30px;
    font-size: 0.95rem;
}

.upload-btn {
    background: linear-gradient(45deg, #8b5cf6, #a855f7);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.4);
}

.drag-text {
    margin-top: 20px;
    color: #94a3b8;
    font-size: 0.9rem;
}

/* Start analysis button styles */
.start-analysis-btn {
    background: linear-gradient(45deg, #4285F4, #9C27B0);
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 6px 25px rgba(66, 133, 244, 0.4);
    margin-top: 20px;
    animation: pulse 2s infinite;
}

.start-analysis-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 35px rgba(66, 133, 244, 0.5);
    background: linear-gradient(45deg, #3367D6, #8E24AA);
}

.start-analysis-btn:active {
    transform: translateY(-1px);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 6px 25px rgba(66, 133, 244, 0.4);
    }
    50% {
        box-shadow: 0 6px 25px rgba(66, 133, 244, 0.6), 0 0 0 10px rgba(66, 133, 244, 0.1);
    }
}

/* Processing Section */
.processing-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    width: 100%;
    position: relative;
    margin: 0 auto;
}

.processing-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 60px 40px;
    text-align: center;
    max-width: 750px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}

.processing-animation {
    margin-bottom: 30px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Diagnostic popup animation */
.diagnosis-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.diagnosis-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.diagnosis-content {
    background: white;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.3s ease;
}

.processing-card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 10px;
}

.processing-card p {
    color: #64748b;
    margin-bottom: 30px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    margin-bottom: 15px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #4285f4, #34a853, #fbbc04, #ea4335);
    border-radius: 6px;
    transition: width 0.5s ease;
    width: 0%;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    color: #4285f4;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Results Section */
.results-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 60px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    max-width: 1800px;
    margin: 0 auto;
}

.results-section::-webkit-scrollbar {
    width: 8px;
}

.results-section::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.results-section::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.results-section::-webkit-scrollbar-thumb:hover {
    background: #5a67d8;
}

/* Results display area */
.result-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-top: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
}

/* Optimized resume content styles */
#resumeContent {
    padding: 20px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    margin-bottom: 20px;
    min-height: 600px;
}

/* Optimized resume container styles */
.resume-preview-container {
    max-height: 1400px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: white;
}

.resume-preview-container::-webkit-scrollbar {
    width: 8px;
}

.resume-preview-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.resume-preview-container::-webkit-scrollbar-thumb {
    background: #8b5cf6;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.resume-preview-container::-webkit-scrollbar-thumb:hover {
    background: #7c3aed;
}

#resumeContent::-webkit-scrollbar {
    width: 6px;
}

#resumeContent::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

#resumeContent::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

/* AI analysis and suggestions content styles */
.analysis-content, .suggestions-content {
    padding: 15px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-top: 10px;
    margin-bottom: 20px;
}

.analysis-content::-webkit-scrollbar,
.suggestions-content::-webkit-scrollbar {
    width: 6px;
}

.analysis-content::-webkit-scrollbar-track,
.suggestions-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.analysis-content::-webkit-scrollbar-thumb,
.suggestions-content::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.results-header {
    text-align: center;
    margin-bottom: 40px;
}

.results-header h3 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.results-header i {
    color: #10b981;
}

.results-header p {
    color: #64748b;
}

.results-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 45px;
    margin-bottom: 40px;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}

.original-resume,
.optimized-resume {
    background: #f8fafc;
    border-radius: 16px;
    padding: 36px;
    border: 1px solid #e2e8f0;
    min-width: 0;
}

.original-resume h4,
.optimized-resume h4 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.optimized-resume {
    border: 2px solid #8b5cf6;
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
}

.optimized-resume h4 i {
    color: #8b5cf6;
}

.resume-preview {
    background: white;
    border-radius: 12px;
    padding: 20px;
    min-height: 600px;
    border: 1px solid #e2e8f0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #374151;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.btn {
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(45deg, #8b5cf6, #a855f7);
    color: white;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.4);
}

.btn-secondary {
    background: white;
    color: #64748b;
    border: 2px solid #e2e8f0;
}

.btn-secondary:hover {
    border-color: #8b5cf6;
    color: #8b5cf6;
    transform: translateY(-2px);
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 0;
    margin-top: 40px;
}

.footer p {
    color: #e2e8f0;
    font-size: 0.9rem;
}

/* Template selector styles */
.template-selector {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.template-modal {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 1200px;
    width: 90%;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.template-modal h2 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 1.8rem;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 30px;
}

.template-option {
    border: 2px solid #e2e8f0;
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    position: relative;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.template-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.template-option:hover::before {
    left: 100%;
}

.template-option:hover {
    border-color: #667eea;
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.2);
}

.template-option h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.template-option p {
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.template-preview {
    background: #f1f5f9;
    border-radius: 6px;
    padding: 10px;
    font-size: 0.8rem;
    color: #475569;
    border-left: 3px solid #667eea;
    margin-top: auto;
}

.template-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.template-close:hover {
    background: #f1f5f9;
    color: #2c3e50;
    transform: rotate(90deg);
}

/* Edit mode styles */
.edit-controls {
    margin-top: 15px;
    text-align: right;
}

.edit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.edit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.resume-editor {
    width: 100%;
    min-height: 300px;
    padding: 20px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    background: #f8fafc;
    transition: border-color 0.3s ease;
}

.resume-editor:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .template-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .upload-area {
        padding: 40px 20px;
        max-width: 90%;
    }
    
    .results-section {
        padding: 30px 20px;
    }
    
    .results-content {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: 100%;
    }
    
    .original-resume,
    .optimized-resume {
        padding: 20px;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    .template-modal {
        padding: 20px;
        margin: 20px;
        max-width: 95%;
    }
    
    .template-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .template-option {
        padding: 20px;
    }
}

/* File Upload Animations */
.file-uploaded {
    animation: fileSuccess 0.5s ease;
}

@keyframes fileSuccess {
    0% {
        transform: scale(1);
        background: rgba(255, 255, 255, 0.95);
    }
    50% {
        transform: scale(1.02);
        background: rgba(16, 185, 129, 0.1);
    }
    100% {
        transform: scale(1);
        background: rgba(255, 255, 255, 0.95);
    }
}

/* Smooth transitions */
.fade-in {
    animation: fadeIn 0.5s ease;
}

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