/* Photo Share Styles v1.0.0 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    font-size: 28px;
    margin-bottom: 8px;
    text-align: center;
    color: #667eea;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.3s;
}

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

.btn-primary {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #fcc;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: #999;
    font-size: 14px;
}

/* Navbar */
.navbar {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-title {
    font-size: 20px;
    color: #667eea;
    font-weight: 600;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.username {
    color: #666;
    font-weight: 500;
}

.btn-logout {
    padding: 8px 16px;
    background: #f5f5f5;
    color: #666;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: #e0e0e0;
}

/* Main Layout */
.container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 70px);
}

.sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid #e0e0e0;
    padding: 24px;
}

.sidebar h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #333;
}

.share-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.share-item {
    padding: 16px;
    background: #f9f9f9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.share-item:hover {
    background: #f0f0f0;
}

.share-item.active {
    background: #667eea;
    color: white;
    border-color: #5568d3;
}

.share-item.active .share-stats {
    color: rgba(255, 255, 255, 0.9);
}

.share-name {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 15px;
}

.share-stats {
    font-size: 13px;
    color: #666;
}

.no-shares {
    color: #999;
    font-style: italic;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 24px;
}

#gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

#current-share-name {
    font-size: 24px;
    color: #333;
}

#gallery-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-secondary {
    padding: 10px 20px;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

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

.photo-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
}

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

.photo-card.selected {
    outline: 4px solid #667eea;
    outline-offset: -4px;
}

.photo-checkbox {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    z-index: 10;
    accent-color: #667eea;
}

.photo-img-container {
    position: relative;
    padding-top: 75%; /* 4:3 aspect ratio */
    background: #f0f0f0;
    overflow: hidden;
}

.photo-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-info {
    padding: 12px;
}

.photo-filename {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.photo-size {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #999;
    font-size: 18px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #667eea;
    font-size: 16px;
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
}

.lightbox-content {
    position: relative;
    z-index: 1001;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    line-height: 1;
}

#lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.lightbox-info {
    background: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

#lightbox-filename {
    font-weight: 500;
    color: #333;
}

.lightbox-info .btn-primary {
    width: auto;
    padding: 8px 16px;
    font-size: 14px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 14px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 12px;
    }
    
    #gallery-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    #gallery-controls {
        width: 100%;
    }
    
    .btn-secondary,
    .btn-primary {
        flex: 1;
        min-width: 0;
    }
}

/* File type icons for non-image files */
.file-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.file-icon-symbol {
    font-size: 48px;
    margin-bottom: 8px;
}

.file-icon-ext {
    font-size: 14px;
    font-weight: 600;
    opacity: 0.9;
}

/* ZIP Download Dialog */
.zip-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.zip-dialog {
    background: white;
    border-radius: 12px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.zip-dialog h3 {
    margin: 0 0 16px 0;
    color: #2d3748;
    font-size: 24px;
}

.zip-dialog > p {
    color: #4a5568;
    margin-bottom: 24px;
    font-size: 16px;
}

.download-option {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    display: flex;
    gap: 16px;
    transition: all 0.2s;
}

.download-option:hover {
    border-color: #667eea;
    background: #f7fafc;
}

.download-option.recommended {
    border-color: #667eea;
    background: #eef2ff;
}

.option-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.option-content h4 {
    margin: 0 0 12px 0;
    color: #2d3748;
    font-size: 18px;
}

.option-content ul {
    margin: 0;
    padding-left: 20px;
    color: #4a5568;
}

.option-content li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.option-content code {
    background: #2d3748;
    color: #68d391;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 14px;
}

.dialog-buttons {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.dialog-buttons button {
    flex: 1;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #2d3748;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 10001;
    max-width: 400px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background: #48bb78;
}

.toast-error {
    background: #f56565;
}

/* Gallery Mode Info */
.gallery-mode-info {
    grid-column: 1 / -1;
    padding: 12px 16px;
    background: #edf2f7;
    border-radius: 8px;
    color: #4a5568;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
}

/* Gallery Mode: Gallery (default, 1-20 photos) */
.photo-grid.mode-gallery {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.mode-gallery .photo-card {
    /* Default styling already in place */
}

/* Gallery Mode: Compact (21-100 photos) */
.photo-grid.mode-compact {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.mode-compact .photo-card {
    padding: 8px;
}

.mode-compact .photo-img-container {
    height: 200px;
}

.mode-compact .photo-filename {
    font-size: 12px;
}

.mode-compact .file-icon {
    width: 180px;
    height: 200px;
}

.mode-compact .file-icon-symbol {
    font-size: 48px;
}

/* Gallery Mode: List (101+ photos) */
.photo-grid.mode-list {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}

.mode-list .photo-card {
    padding: 4px;
}

.mode-list .photo-img-container {
    height: 100px;
}

.mode-list .photo-filename {
    font-size: 10px;
    padding: 4px;
}

.mode-list .photo-info {
    padding: 2px 4px;
}

.mode-list .file-icon {
    width: 100px;
    height: 100px;
}

.mode-list .file-icon-symbol {
    font-size: 32px;
}

.mode-list .file-icon-ext {
    font-size: 10px;
}

.mode-list .photo-checkbox {
    width: 16px;
    height: 16px;
}
