/* Reset and Base Styles */
* {
    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: #f5f5f5;
}

/* Ad Column - 300px reserved on the right */
.ad-column {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100vh;
    background: #e2e8f0;
    border-left: 1px solid #cbd5e0;
    z-index: 50;
    padding: 20px;
    overflow-y: auto;
}

.ad-column-placeholder {
    text-align: center;
    color: #718096;
    font-size: 0.9rem;
    padding-top: 20px;
}

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

/* Landing Page */
.landing-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-right: 300px;
}

.logo-section {
    text-align: center;
    margin-bottom: 60px;
}

.logo {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
}

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

/* Upload Section */
.upload-section {
    display: flex;
    justify-content: center;
    margin-bottom: 60px;
}

.drop-zone {
    background: rgba(255, 255, 255, 0.95);
    border: 3px dashed #667eea;
    border-radius: 20px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 400px;
}

.drop-zone:hover {
    background: white;
    border-color: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.drop-zone.drag-over {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
    transform: scale(1.02);
}

.upload-icon {
    color: #667eea;
    margin-bottom: 20px;
}

.drop-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.drop-subtext {
    color: #666;
    margin-bottom: 20px;
}

.upload-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.upload-btn:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.file-info {
    margin-top: 15px;
    font-size: 0.9rem;
    color: #666;
}

.sample-link {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #666;
}

.sample-link a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.sample-link a:hover {
    text-decoration: underline;
    color: #764ba2;
}

/* Info Sections */
.info-sections {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

@media (max-width: 900px) {
    .info-sections {
        grid-template-columns: 1fr;
    }
}

.info-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
}

.info-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.info-card p {
    opacity: 0.9;
    line-height: 1.8;
}

/* Landing Footer */
.landing-footer {
    margin-top: 60px;
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.8;
}

.landing-footer a {
    color: white;
    text-decoration: none;
    font-weight: 500;
}

.landing-footer a:hover {
    text-decoration: underline;
}

/* Gallery Footer */
.gallery-footer {
    padding: 30px;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
}

.gallery-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.gallery-footer a:hover {
    text-decoration: underline;
    color: #764ba2;
}

/* Gallery View */
.gallery-view {
    min-height: 100vh;
    background: #f5f5f5;
    margin-right: 300px;
}

.toolbar {
    background: white;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.toolbar-title {
    font-size: 1.8rem;
    color: #667eea;
}

.toolbar-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

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

.btn-primary {
    background: #667eea;
    color: white;
}

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

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.3);
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-secondary:hover {
    background: #4a5568;
}

/* Global Controls */
.global-controls {
    background: white;
    padding: 25px;
    margin: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.global-controls h3 {
    margin-bottom: 20px;
    color: #667eea;
    font-size: 1.3rem;
}

.global-controls-content {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.global-preview {
    flex-shrink: 0;
    padding: 20px;
    background: #f7fafc;
    border-radius: 8px;
}

.global-buttons {
    flex: 1;
    padding-top: 10px;
}

.preview-label {
    margin-bottom: 10px;
    font-weight: 600;
    color: #2d3748;
}

.preview-container {
    position: relative;
    width: 300px;
    height: 400px;
    margin: 0 auto;
    background: #cbd5e0;
    border: 2px solid #a0aec0;
    border-radius: 8px;
    overflow: hidden;
}

.preview-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: default;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.control-btn {
    background: #edf2f7;
    border: 1px solid #cbd5e0;
    padding: 8px 16px;
    margin: 5px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Photo Gallery */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    padding: 25px;
}

.photo-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.photo-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.photo-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.photo-container img {
    display: block;
    width: 100%;
    height: auto;
}

.photo-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: default;
}

.photo-controls {
    padding: 15px;
    background: #f7fafc;
}

.photo-controls h4 {
    margin-bottom: 12px;
    color: #2d3748;
    font-size: 0.95rem;
}

.individual-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 5px;
}

.control-row strong {
    min-width: 60px;
    font-size: 0.85rem;
}

.individual-controls .control-btn {
    font-size: 0.85rem;
    padding: 6px 12px;
}

/* Detection and Crop Box Styles (for canvas) */
.detection-box {
    stroke-width: 3;
}

.detection-box.face-detected {
    stroke: #e53e3e;
    fill: rgba(229, 62, 62, 0.1);
}

.detection-box.no-face {
    stroke: #a0aec0;
    fill: rgba(160, 174, 192, 0.1);
}

.crop-box {
    stroke: #48bb78;
    stroke-width: 3;
    fill: rgba(72, 187, 120, 0.15);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    pointer-events: auto;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    color: white;
    font-size: 1.2rem;
    margin-top: 20px;
    font-weight: 500;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ad-column {
        display: none;
    }

    .landing-page,
    .gallery-view {
        margin-right: 0;
    }

    .logo {
        font-size: 2rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .drop-zone {
        min-width: auto;
        padding: 40px 20px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-buttons {
        justify-content: center;
    }

    .photo-gallery {
        grid-template-columns: 1fr;
        padding: 15px;
    }

    .global-controls {
        margin: 15px;
        padding: 20px;
    }

    .global-controls-content {
        flex-direction: column;
    }

    .global-preview {
        width: 100%;
    }

    .preview-container {
        margin: 0 auto;
    }

    .control-btn {
        font-size: 0.85rem;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .drop-zone {
        padding: 30px 15px;
    }

    .upload-btn {
        padding: 12px 30px;
        font-size: 1rem;
    }

    .btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }
}
