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

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header .logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 15px;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.auth-section {
    padding: 30px;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.input-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.input-field {
    flex: 1;
    min-width: 200px;
}

.input-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.input-field input {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.input-field input:focus {
    outline: none;
    border-color: #667eea;
}

button {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

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

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

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

.btn-secondary:hover {
    background: #5a6268;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.controls {
    padding: 20px 30px;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.grid-size-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.grid-size-controls label {
    font-weight: 600;
    color: #495057;
}

.grid-btn {
    padding: 8px 20px;
    background: white;
    color: #495057;
    border: 2px solid #dee2e6;
}

.grid-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.action-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.selection-info {
    font-weight: 600;
    color: #495057;
}

.gallery {
    padding: 30px;
    min-height: 400px;
}

.photo-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(2, 1fr);
}

.photo-grid.medium {
    grid-template-columns: repeat(4, 1fr);
}

.photo-grid.small {
    grid-template-columns: repeat(6, 1fr);
}

@media (max-width: 1200px) {
    .photo-grid.small {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .photo-grid {
        grid-template-columns: repeat(1, 1fr) !important;
    }

    .photo-grid.medium {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .photo-grid.small {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

.photo-card {
    position: relative;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 3px solid transparent;
}

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

.photo-card.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

.photo-card img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.photo-card .checkbox-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.photo-card.selected .checkbox-overlay {
    background: #667eea;
    border-color: #667eea;
}

.photo-card.selected .checkbox-overlay::after {
    content: "✓";
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.loading {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

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

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

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px 20px;
    margin: 20px 30px;
    border-radius: 6px;
    border-left: 4px solid #f5c6cb;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state h3 {
    margin-bottom: 10px;
    font-size: 1.5em;
}

.fullscreen-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.fullscreen-modal.active {
    display: flex;
}

.fullscreen-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.fullscreen-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    transition: transform 0.2s ease;
    cursor: grab;
    user-select: none;
}

.fullscreen-content img.panning {
    cursor: grabbing;
    transition: none;
}

.fullscreen-controls {
    position: absolute;
    top: 20px;
    left: 30px;
    display: flex;
    gap: 10px;
    z-index: 10000;
}

.fullscreen-btn {
    background: white;
    color: black;
    border: none;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 45px;
}

.fullscreen-btn:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.fullscreen-close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    background: white;
    color: black;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.fullscreen-close-btn:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.zoom-level {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    color: black;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    z-index: 10000;
}
