* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.navbar {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar h1 {
    font-size: 1.25rem;
    color: #764ba2;
}

.navbar h1 a {
    color: #764ba2;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-links a {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    transition: color 0.3s;
    padding: 0.5rem;
}

.nav-links a:hover {
    color: #764ba2;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 101;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: #764ba2;
    margin: 3px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.hero {
    text-align: center;
    padding: 2rem 1rem;
    color: white;
}

.hero h2 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.hero p {
    font-size: 1rem;
    opacity: 0.9;
}

.container {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

.container h2 {
    color: white;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.mode-selection {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.mode-selection h3 {
    text-align: center;
    margin-bottom: 1.25rem;
    color: #764ba2;
    font-size: 1.25rem;
}

.modes {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.mode-card {
    padding: 1.25rem;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.3s;
}

.mode-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.mode-card.active {
    border-color: #764ba2;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
}

.mode-card h4 {
    color: #764ba2;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.mode-card ul {
    list-style: none;
    margin: 0.75rem 0;
}

.mode-card ul li {
    padding: 0.25rem 0;
    font-size: 0.95rem;
}

.mode-card ul li:before {
    content: "✓ ";
    color: #4CAF50;
    font-weight: bold;
}

.analysis-section {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.analysis-section h3 {
    font-size: 1.25rem;
    color: #764ba2;
    margin-bottom: 0.75rem;
}

.info-text {
    color: #666;
    margin-bottom: 1.25rem;
    text-align: center;
    font-size: 0.95rem;
}

.upload-area {
    border: 3px dashed #764ba2;
    border-radius: 10px;
    padding: 2rem 1rem;
    text-align: center;
    margin-bottom: 1.25rem;
    background: #f9f9f9;
    transition: all 0.3s;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.upload-area:hover, .upload-area:focus-within {
    background: #f0f0f0;
    border-color: #667eea;
}

.upload-area input[type="file"] {
    display: none;
}

.upload-area label {
    cursor: pointer;
    display: block;
    width: 100%;
}

.upload-area label span {
    display: block;
    font-size: 1.1rem;
    color: #764ba2;
    margin-bottom: 0.5rem;
}

.upload-area label small {
    color: #999;
    font-size: 0.85rem;
}

.image-preview img {
    max-width: 100%;
    max-height: 250px;
    margin-top: 1rem;
    border-radius: 10px;
    object-fit: contain;
}

.btn-primary, .btn-secondary {
    padding: 1rem 2rem;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-block;
    text-decoration: none;
    text-align: center;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.btn-primary:hover, .btn-primary:active {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(118, 75, 162, 0.4);
}

.btn-secondary {
    background: #4CAF50;
    color: white;
    margin-top: 1rem;
    width: 100%;
}

.loading-indicator {
    text-align: center;
    padding: 2rem 1rem;
}

.loading-indicator p {
    font-size: 0.95rem;
    color: #666;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #764ba2;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.results-container {
    margin-top: 1.5rem;
}

.alert-banner {
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
}

.alert-critical {
    background: #f44336;
    color: white;
}

.alert-warning {
    background: #ff9800;
    color: white;
}

.alert-caution {
    background: #ffc107;
    color: #333;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.result-card {
    background: #f9f9f9;
    padding: 1.25rem;
    border-radius: 10px;
    border-left: 4px solid #764ba2;
}

.result-card h4 {
    color: #764ba2;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.result-value {
    font-size: 1rem;
    font-weight: 600;
}

.result-value small {
    font-weight: 400;
    color: #666;
}

.detailed-results, .recommendations {
    background: #f9f9f9;
    padding: 1.25rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.detailed-results h4, .recommendations h4 {
    color: #764ba2;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.features {
    background: white;
    border-radius: 15px;
    padding: 2rem 1.5rem;
    margin-top: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.features h3 {
    text-align: center;
    color: #764ba2;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.feature-item {
    text-align: center;
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.feature-item h4 {
    color: #764ba2;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.feature-item p {
    font-size: 0.85rem;
    color: #666;
}

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
    padding: 1rem;
}

.auth-card {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.auth-card h2 {
    color: #764ba2;
    margin-bottom: 1.25rem;
    text-align: center;
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 500;
    font-size: 0.95rem;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.9rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
    -webkit-appearance: none;
    appearance: none;
}

.form-group select {
    background: 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='%23764ba2' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 1rem center;
    background-color: white;
    padding-right: 2.5rem;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: #764ba2;
}

.auth-link {
    text-align: center;
    margin-top: 1rem;
    color: #666;
    font-size: 0.95rem;
}

.auth-link a {
    color: #764ba2;
    text-decoration: none;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    padding: 1.25rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.stat-card h3 {
    font-size: 1.75rem;
    color: #764ba2;
    margin-bottom: 0.25rem;
}

.stat-card p {
    font-size: 0.85rem;
    color: #666;
}

.stat-card.alert-card h3 {
    color: #f44336;
}

.stat-card.success-card h3 {
    color: #4CAF50;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.dashboard-section {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.dashboard-section h3 {
    color: #764ba2;
    margin-bottom: 1.25rem;
    font-size: 1.1rem;
}

.hives-list {
    margin-top: 1rem;
}

.hive-card {
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border-left: 4px solid #4CAF50;
}

.hive-card h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.hive-card p {
    font-size: 0.9rem;
    color: #666;
    margin: 0.25rem 0;
}

.upload-area-small {
    margin: 1rem 0;
}

.upload-area-small input[type="file"] {
    display: none;
}

.upload-area-small label {
    display: block;
    padding: 1rem;
    background: #f0f0f0;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    font-size: 0.95rem;
    border: 2px dashed #ccc;
    transition: all 0.3s;
}

.upload-area-small label:hover, .upload-area-small label:focus-within {
    border-color: #764ba2;
    background: #f9f9f9;
}

.recent-analyses {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-top: 1.5rem;
}

.recent-analyses h3 {
    color: #764ba2;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1.5rem;
    padding: 0 1.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

table thead {
    background: #764ba2;
    color: white;
}

table th, table td {
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.9rem;
    white-space: nowrap;
}

table tbody tr:hover {
    background: #f9f9f9;
}

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

.modal-content {
    background-color: white;
    padding: 1.5rem;
    border-radius: 15px;
    width: 100%;
    max-width: 600px;
    margin: 2rem 0;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    position: relative;
}

.modal-content h3 {
    color: #764ba2;
    margin-bottom: 1.25rem;
    font-size: 1.25rem;
    padding-right: 2rem;
}

.modal-large {
    max-width: 900px;
}

.close {
    color: #aaa;
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
    z-index: 1;
}

.close:hover {
    color: #000;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.admin-section {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.admin-section h3 {
    color: #764ba2;
    margin-bottom: 1.25rem;
    font-size: 1.1rem;
}

.severity-stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.severity-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.severity-label {
    min-width: 80px;
    font-weight: 600;
    font-size: 0.9rem;
}

.severity-count {
    min-width: 70px;
    font-size: 0.9rem;
}

.severity-bar {
    height: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
    flex: 1;
    min-width: 50px;
}

.locations-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.location-item {
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 8px;
}

.location-item strong {
    display: block;
    margin-bottom: 0.25rem;
}

.location-item p {
    font-size: 0.9rem;
    color: #666;
    margin: 0.25rem 0;
}

.location-item small {
    color: #999;
    font-size: 0.8rem;
}

.admin-table {
    font-size: 0.85rem;
}

.btn-small {
    padding: 0.5rem 0.75rem;
    background: #764ba2;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    min-height: 36px;
    -webkit-tap-highlight-color: transparent;
}

.btn-small:hover, .btn-small:active {
    background: #667eea;
}

.severity-badge {
    padding: 0.3rem 0.5rem;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.severity-none { background: #4CAF50; color: white; }
.severity-low { background: #ffc107; color: #333; }
.severity-moderate { background: #ff9800; color: white; }
.severity-high { background: #f44336; color: white; }
.severity-severe { background: #b71c1c; color: white; }

.alert-text {
    color: #f44336;
    font-weight: bold;
}

.anomalies-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.anomaly-item {
    background: #fff3cd;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
}

.anomaly-item strong {
    display: block;
    margin-bottom: 0.25rem;
}

.anomaly-item p {
    font-size: 0.9rem;
    margin: 0;
}

.analysis-detail p {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.analysis-detail hr {
    margin: 1rem 0;
    border: none;
    border-top: 1px solid #e0e0e0;
}

details {
    margin-top: 1rem;
    cursor: pointer;
}

details summary {
    padding: 0.5rem 0;
    font-weight: 600;
    color: #764ba2;
}

pre {
    background: #f5f5f5;
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    font-size: 0.8rem;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 480px) {
    .feature-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 640px) {
    .nav-container {
        padding: 0 2rem;
    }
    
    .navbar h1 {
        font-size: 1.5rem;
    }
    
    .hero {
        padding: 3rem 2rem;
    }
    
    .hero h2 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1.1rem;
    }
    
    .container {
        padding: 0 2rem;
        margin: 2rem auto;
    }
    
    .container h2 {
        font-size: 1.75rem;
    }
    
    .modes {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .mode-selection, .analysis-section {
        padding: 2rem;
    }
    
    .auth-card {
        padding: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .admin-stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .locations-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .hero h2 {
        font-size: 2.5rem;
    }
    
    .hero p {
        font-size: 1.2rem;
    }
    
    .results-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .btn-primary {
        width: auto;
    }
    
    .btn-secondary {
        width: auto;
    }
    
    .image-preview img {
        max-width: 300px;
        max-height: 300px;
    }
}

@media (min-width: 1024px) {
    .locations-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .admin-stats-grid {
        grid-template-columns: repeat(8, 1fr);
    }
}

@media (max-width: 639px) {
    .hamburger {
        display: flex;
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        max-width: 280px;
        height: 100vh;
        background: white;
        flex-direction: column;
        padding: 5rem 2rem 2rem;
        box-shadow: -2px 0 10px rgba(0,0,0,0.1);
        transition: right 0.3s ease;
        gap: 0;
    }
    
    .nav-links.active {
        right: 0;
    }
    
    .nav-links a {
        padding: 1rem 0;
        border-bottom: 1px solid #eee;
        font-size: 1.1rem;
    }
    
    .nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }
    
    .nav-overlay.active {
        display: block;
    }
}
