* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.upload-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 30px;
}

.upload-box {
    border: 3px dashed #cbd5e0;
    border-radius: 8px;
    padding: 60px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-box:hover {
    border-color: #667eea;
    background-color: #f7fafc;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    color: #4a5568;
}

.upload-label svg {
    color: #667eea;
}

.upload-label span:first-of-type {
    font-size: 1.2rem;
    font-weight: 600;
}

.upload-hint {
    font-size: 0.9rem;
    color: #a0aec0;
}

.image-preview {
    text-align: center;
}

.image-preview h3 {
    margin-bottom: 20px;
    color: #2d3748;
}

.image-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
}

.image-name {
    font-size: 0.95rem;
    color: #4a5568;
    font-style: italic;
    margin-bottom: 20px;
    word-break: break-all;
}

.btn-classify {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-classify:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-classify:active {
    transform: translateY(0);
}

.loading-section {
    background: white;
    border-radius: 12px;
    padding: 60px 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-section p {
    color: #4a5568;
    font-size: 1.1rem;
}

.results-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.results-section h2 {
    text-align: center;
    color: #2d3748;
    margin-bottom: 30px;
    font-size: 2rem;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 30px;
}

.model-results {
    background: #f7fafc;
    border-radius: 8px;
    padding: 20px;
}

.model-title {
    text-align: center;
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.3rem;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.prediction-item {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.prediction-item:hover {
    transform: translateX(5px);
}

.prediction-item.rank-1 {
    border-left: 4px solid #48bb78;
}

.prediction-item.rank-2 {
    border-left: 4px solid #4299e1;
}

.prediction-item.rank-3 {
    border-left: 4px solid #ed8936;
}

.prediction-rank {
    font-size: 0.9rem;
    color: #718096;
    font-weight: 600;
    margin-bottom: 5px;
}

.prediction-name {
    font-size: 1.1rem;
    color: #2d3748;
    font-weight: 600;
    margin-bottom: 5px;
}

.prediction-class {
    font-size: 0.85rem;
    color: #a0aec0;
    margin-bottom: 10px;
    font-family: 'Courier New', monospace;
}

.confidence-bar-container {
    background: #e2e8f0;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.confidence-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.rank-1 .confidence-bar {
    background: linear-gradient(90deg, #48bb78, #38a169);
}

.rank-2 .confidence-bar {
    background: linear-gradient(90deg, #4299e1, #3182ce);
}

.rank-3 .confidence-bar {
    background: linear-gradient(90deg, #ed8936, #dd6b20);
}

.confidence-text {
    text-align: right;
    font-size: 1rem;
    font-weight: 700;
    color: #2d3748;
}

.error-section {
    background: white;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.error-message {
    color: #e53e3e;
}

.error-message svg {
    margin-bottom: 15px;
}

.error-message p {
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }
}

/* Login Page Styles */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.login-box {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

#loginForm {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.code-input-container {
    position: relative;
}

.code-input-container input {
    width: 100%;
    padding: 20px 15px 10px 15px;
    font-size: 2rem;
    text-align: center;
    letter-spacing: 10px;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s ease;
    font-family: 'Courier New', monospace;
}

.code-input-container input:focus {
    border-color: #667eea;
}

.code-input-container input::placeholder {
    color: #e2e8f0;
    letter-spacing: 8px;
}

.code-input-container label {
    position: absolute;
    top: 5px;
    left: 15px;
    font-size: 0.75rem;
    color: #a0aec0;
    pointer-events: none;
}

.btn-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.login-error {
    background: #fed7d7;
    color: #c53030;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.95rem;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}
