/* Global Styles */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-bg: #f8f9fa;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --shadow-light: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-medium: 0 4px 20px rgba(0,0,0,0.15);
    --shadow-heavy: 0 8px 30px rgba(0,0,0,0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    line-height: 1.6;
}

/* Navigation */
.navbar {
    background: var(--gradient) !important;
    box-shadow: var(--shadow-medium);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

/* Hero Section */
.hero-section {
    background: var(--gradient);
    color: white;
    padding: 80px 0;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.hero-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    line-height: 1.8;
}

.hero-icon {
    text-align: center;
}

.hero-icon i {
    font-size: 8rem;
    opacity: 0.2;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

/* Upload Card */
.upload-card {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-heavy);
    overflow: hidden;
    border: none;
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border: none;
}

.card-header h3 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card-body {
    padding: 2.5rem;
}

/* Upload Area */
.upload-area {
    border: 3px dashed #cbd5e0;
    border-radius: 15px;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    background: #f8f9fa;
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(102,126,234,0.1) 0%, transparent 70%);
    transform: scale(0);
    transition: transform 0.6s ease;
}

.upload-area:hover {
    border-color: var(--secondary-color);
    background: rgba(102,126,234,0.05);
    transform: translateY(-2px);
}

.upload-area:hover::before {
    transform: scale(1);
}

.upload-area.dragover {
    border-color: var(--success-color);
    background: rgba(39,174,96,0.1);
}

.upload-content {
    position: relative;
    z-index: 2;
}

.upload-icon {
    font-size: 4rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.upload-area h4 {
    color: #2d3748;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.upload-area p {
    color: #718096;
    margin-bottom: 1.5rem;
}

/* Preview Section */
.preview-section {
    margin-top: 2rem;
    text-align: center;
}

.preview-section.show {
    display: block !important;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preview-container {
    position: relative;
    display: inline-block;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-medium);
}

.preview-container img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 15px;
    transition: transform 0.3s ease;
}

.preview-container:hover img {
    transform: scale(1.02);
}

.image-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease;
}

.image-overlay:hover {
    background: var(--danger-color);
}

/* Buttons */
.btn {
    border-radius: 50px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-lg {
    padding: 1rem 3rem;
    font-size: 1.1rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-success {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    border: none;
    box-shadow: 0 4px 15px rgba(39,174,96,0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39,174,96,0.4);
}

.btn-primary {
    background: linear-gradient(45deg, var(--secondary-color), #5dade2);
    border: none;
    box-shadow: 0 4px 15px rgba(52,152,219,0.3);
}

/* Results Section */
.result-section {
    margin-top: 2rem;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.result-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: var(--shadow-light);
    border-left: 5px solid var(--success-color);
}

.result-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.result-header i {
    font-size: 2rem;
    color: var(--success-color);
    margin-right: 1rem;
}

.result-item {
    background: white;
    padding: 1rem 1.5rem;
    margin-bottom: 0.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-label {
    font-weight: 600;
    color: #2d3748;
}

.result-value {
    font-weight: 500;
    color: var(--secondary-color);
}

.confidence-bar {
    background: #e2e8f0;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), #2ecc71);
    border-radius: 5px;
    transition: width 1s ease;
    position: relative;
}

.confidence-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Information Cards */
.info-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-light);
    text-align: center;
    transition: all 0.3s ease;
    height: 100%;
    border-top: 4px solid var(--secondary-color);
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
}

.info-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(45deg, var(--secondary-color), #5dade2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: white;
    font-size: 1.5rem;
}

.info-card h5 {
    color: #2d3748;
    margin-bottom: 1rem;
    font-weight: 600;
}

.info-card p {
    color: #718096;
    line-height: 1.6;
}

/* Footer */
.footer {
    background: #2d3748;
    color: #a0aec0;
    padding: 2rem 0;
    margin-top: 4rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero-icon i {
        font-size: 4rem;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
}

/* Loading Animation */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Alert Styles */
.alert {
    border-radius: 10px;
    border: none;
    box-shadow: var(--shadow-light);
}

.alert-danger {
    background: linear-gradient(135deg, #ffe6e6, #ffcccc);
    color: #c53030;
}

/* Utilities */
.d-none {
    display: none !important;
}

.text-gradient {
    background: linear-gradient(45deg, var(--secondary-color), #5dade2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#statusIndicator {
    background: rgba(0, 0, 0, 0.2);
    padding: 5px 12px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* Online State (Green) */
.status-online .status-dot {
    background-color: #2ecc71;
    box-shadow: 0 0 10px #2ecc71;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(46, 204, 113, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

/* Offline State (Red/Orange) */
.status-offline .status-dot {
    background-color: #e74c3c;
    box-shadow: 0 0 10px #e74c3c;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(231, 76, 60, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

/* --- NEW: Progress Bar Styles --- */
.progress {
    background-color: #e9ecef;
    border-radius: 10px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.progress-bar {
    transition: width 0.4s ease;
}

