/* iOS Glass Morphism Style */
:root {
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.25);
    --glass-shadow: rgba(0, 0, 0, 0.1);
    --primary-color: #007AFF;
    --success-color: #34C759;
    --danger-color: #FF3B30;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --blur-amount: 20px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Background */
.background-blur {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    z-index: -1;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px var(--glass-shadow);
}

.glass-input {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px 18px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.3s ease;
}

.glass-input::placeholder {
    color: var(--text-secondary);
}

.glass-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.15);
}

.glass-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.glass-btn.primary {
    background: linear-gradient(135deg, var(--primary-color), #5856D6);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.4);
}

.glass-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.5);
}

.glass-btn.danger {
    background: linear-gradient(135deg, var(--danger-color), #FF2D55);
    color: white;
}

.glass-btn.danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 59, 48, 0.5);
}

/* Header */
.header {
    padding: 20px 40px;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.header h1 {
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header h1 i {
    color: var(--primary-color);
}

nav {
    display: flex;
    gap: 12px;
}

.nav-link {
    padding: 10px 20px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: all 0.3s ease;
    background: transparent;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255, 255, 255, 0.2);
}

/* Main Container */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px 40px;
}

/* Upload Section */
.upload-section {
    margin-bottom: 40px;
}

.upload-card {
    padding: 30px;
}

.upload-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    background: rgba(0, 0, 0, 0.1);
    padding: 6px;
    border-radius: 14px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.upload-area {
    border: 2px dashed var(--glass-border);
    border-radius: 16px;
    padding: 50px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(0, 122, 255, 0.1);
}

.upload-icon {
    font-size: 60px;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.upload-area p {
    font-size: 17px;
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 13px;
    color: var(--text-secondary);
}

.url-input-group {
    display: flex;
    gap: 12px;
}

.url-input-group .glass-input {
    flex: 1;
}

/* Upload Progress */
.upload-progress {
    margin-top: 20px;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #5856D6);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Gallery Section */
.gallery-section {
    margin-top: 30px;
}

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

.gallery-header h2 {
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.count-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

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

.image-card {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
}

.image-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.image-card img {
    width: 100%;
    height: auto;
    display: block;
    min-height: 150px;
    object-fit: cover;
}

.image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 15px 15px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-card:hover .image-overlay {
    opacity: 1;
}

.image-info {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

/* Loading & Empty State */
.loading, .empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.loading i {
    font-size: 32px;
    margin-bottom: 15px;
}

.empty-state i {
    font-size: 60px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 16px;
}

.hidden {
    display: none !important;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    max-width: 90vw;
    max-height: 90vh;
    padding: 25px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--danger-color);
    transform: rotate(90deg);
}

.modal-content img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 12px;
}

.preview-info {
    margin-top: 20px;
    display: flex;
    gap: 12px;
}

.preview-info .glass-input {
    flex: 1;
    font-size: 13px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-size: 14px;
}

.footer i {
    color: var(--danger-color);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 15px 20px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
    }
    
    .main-container {
        padding: 0 20px 30px;
    }
    
    .masonry-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .url-input-group {
        flex-direction: column;
    }
    
    .preview-info {
        flex-direction: column;
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 16px 30px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    z-index: 2000;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: var(--success-color);
    color: white;
    box-shadow: 0 8px 25px rgba(52, 199, 89, 0.4);
}

.toast.error {
    background: var(--danger-color);
    color: white;
    box-shadow: 0 8px 25px rgba(255, 59, 48, 0.4);
}
