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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --error-color: #ef4444;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    padding: 20px;
    padding-top: 70px; /* Space for announcement banner */
    color: var(--text-dark);
    position: relative;
    overflow-x: hidden;
}

/* Announcement Banner */
.announcement-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.5s ease-out;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.announcement-banner.hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.announcement-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
}

.announcement-icon {
    font-size: 20px;
    animation: pulse 2s ease-in-out infinite;
    transition: opacity 0.3s ease;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.announcement-text {
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    animation: fadeIn 0.8s ease-in;
    transition: opacity 0.3s ease;
}

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

.announcement-close {
    position: absolute;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    line-height: 1;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.announcement-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
    body {
        padding-top: 80px;
    }
    
    .announcement-banner {
        padding: 10px 15px;
    }
    
    .announcement-text {
        font-size: 13px;
        padding-right: 35px;
    }
    
    .announcement-icon {
        font-size: 18px;
    }
}

/* Background image with blur effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('../images/NITK_surathkal.jpg') no-repeat center center;
    background-size: cover;
    filter: blur(3px);
    opacity: 0.45;
    z-index: -2;
}

/* Gradient overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.5) 0%, rgba(118, 75, 162, 0.5) 100%);
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Upload Section */
.upload-section {
    background: var(--bg-white);
    border-radius: 20px;
    padding: 60px 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    transition: all 0.3s ease;
}

.upload-box {
    border: 3px dashed var(--border-color);
    border-radius: 15px;
    padding: 60px 40px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-box:hover {
    border-color: var(--primary-color);
    background: var(--bg-light);
}

.upload-box.dragover {
    border-color: var(--primary-color);
    background: var(--bg-light);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.upload-box h2 {
    font-size: 1.8rem;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.upload-box p {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.upload-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-camera {
    background: var(--secondary-color);
    color: white;
}

.btn-camera:hover {
    background: #7c3aed;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Buttons */
.btn {
    padding: 14px 32px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-download {
    background: var(--success-color);
    color: white;
}

.btn-download:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-download:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    display: inline-block;
    margin-right: 5px;
}

/* Loading Section */
.loading-section {
    background: var(--bg-white);
    border-radius: 20px;
    padding: 80px 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid var(--bg-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 30px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.loading-subtext {
    color: var(--text-light);
    font-size: 1rem;
}

/* Results Section */
.results-section {
    background: var(--bg-white);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

/* Your Selfie Section */
.your-selfie-section {
    margin: 30px 0;
    display: flex;
    justify-content: center;
}

.selfie-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 300px;
}

.selfie-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.selfie-label::before {
    content: '🤳';
    font-size: 1.3rem;
}

.selfie-image {
    width: 100%;
    max-width: 260px;
    height: auto;
    border-radius: 12px;
    border: 3px solid white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    object-fit: cover;
}

@media (max-width: 768px) {
    .selfie-card {
        max-width: 250px;
        padding: 15px;
    }
    
    .selfie-image {
        max-width: 220px;
    }
}

/* Matches Heading */
.matches-heading {
    text-align: center;
    margin: 30px 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.matches-heading h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    font-weight: 600;
    display: inline-block;
    position: relative;
}

.matches-heading h3::before {
    content: '📷';
    margin-right: 10px;
}

@media (max-width: 768px) {
    .matches-heading h3 {
        font-size: 1.3rem;
    }
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.results-header h2 {
    font-size: 2rem;
    color: var(--text-dark);
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.results-stats {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    text-align: center;
}

.results-stats p {
    font-size: 1.1rem;
    color: var(--text-light);
}

.results-stats strong {
    color: var(--primary-color);
    font-size: 1.3rem;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}

/* Load More Button */
.load-more-container {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    margin-top: 20px;
    margin-bottom: 20px;
}

.load-more-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.load-more-btn:active {
    transform: translateY(0);
}

.load-more-count {
    opacity: 0.9;
    font-size: 0.95rem;
    font-weight: 500;
}

.result-card {
    background: var(--bg-white);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    position: relative;
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.result-card:hover .card-actions {
    opacity: 1;
}

.card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

/* Show card actions on mobile devices (touch screens) */
@media (hover: none) and (pointer: coarse) {
    .card-actions {
        opacity: 1;
    }
}

/* Always show download buttons on smaller screens */
@media (max-width: 768px) {
    .card-actions {
        opacity: 1 !important;
    }
}

.card-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-dark);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
}

.card-btn:hover {
    background: white;
    transform: scale(1.1);
}

.card-btn.download-btn {
    background: rgba(16, 185, 129, 0.95);
    color: white;
}

.card-btn.download-btn:hover {
    background: var(--success-color);
}

.result-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    background: var(--bg-light);
    cursor: pointer;
}

.result-info {
    padding: 15px;
    text-align: center;
}

.result-filename {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-similarity {
    display: inline-block;
    padding: 6px 14px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95rem;
}

.face-description {
    font-size: 0.85rem;
    color: var(--secondary-color);
    margin-top: 8px;
    font-weight: 500;
}

.group-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(139, 92, 246, 0.95);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Error Section */
.error-section {
    background: var(--bg-white);
    border-radius: 20px;
    padding: 60px 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.error-section h2 {
    font-size: 2rem;
    color: var(--error-color);
    margin-bottom: 15px;
}

.error-section p {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* Footer */
.footer {
    text-align: center;
    color: white;
    margin-top: 40px;
    opacity: 0.9;
}

/* Camera Modal */
.camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.camera-container {
    background: var(--bg-white);
    border-radius: 20px;
    padding: 30px;
    max-width: 90%;
    max-height: 90vh;
    overflow: hidden;
}

.camera-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.camera-header h2 {
    font-size: 1.5rem;
    color: var(--text-dark);
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.camera-content {
    margin-bottom: 20px;
}

#cameraVideo {
    width: 100%;
    max-width: 640px;
    height: auto;
    border-radius: 10px;
    background: var(--text-dark);
    transform: scaleX(-1); /* Mirror effect for natural selfie view */
}

.camera-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Crop Modal Styles */
.crop-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.crop-container {
    background: var(--bg-white);
    border-radius: 20px;
    padding: 30px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.crop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.crop-header h2 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin: 0;
}

.crop-content {
    flex: 1;
    max-height: calc(90vh - 150px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

.crop-content img {
    max-width: 100%;
    display: block;
}

.crop-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .upload-section {
        padding: 40px 20px;
    }

    .upload-box {
        padding: 40px 20px;
    }

    .results-section {
        padding: 20px;
    }

    .results-header {
        flex-direction: column;
        text-align: center;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
    }

    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }

    .result-image {
        height: 200px;
    }
}

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

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

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

