:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --error-color: #ef4444;
    --success-color: #10b981;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1a1e3a 100%);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

header .subtext {
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Main Content */
main {
    flex: 1;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 1rem;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    background: var(--card-bg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.drop-zone:hover {
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.05);
    transform: translateY(-2px);
}

.drop-zone.active {
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.1);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.drop-zone-content svg {
    color: var(--accent-color);
    width: 48px;
    height: 48px;
}

.drop-zone span {
    display: block;
}

.drop-zone span:first-of-type {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-color);
}

.subtext {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Preview Container */
.preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
    min-height: 0;
}

.preview-item {
    position: relative;
    border-radius: 0.75rem;
    overflow: hidden;
    aspect-ratio: 1;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    animation: scaleIn 0.3s ease;
    cursor: pointer;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preview-item .remove-btn {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0;
}

.preview-item:hover .remove-btn {
    opacity: 1;
}

.preview-item .remove-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* Actions */
.actions {
    margin-top: 2rem;
    text-align: center;
}

.btn {
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    transition: all 0.2s ease;
    display: inline-block;
    text-decoration: none;
}

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

.btn.primary:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn.primary:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    opacity: 0.5;
}

.btn.secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn.secondary:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(59, 130, 246, 0.05);
}

/* Progress Bar */
.progress-container {
    margin-top: 2rem;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, var(--accent-color), #8b5cf6);
    width: 0%;
    transition: width 0.3s ease;
}

#progress-text {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Result Container */
.result-container {
    margin-top: 2rem;
    padding: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    text-align: center;
    animation: slideUp 0.3s ease;
}

.result-container h3 {
    margin-bottom: 1.5rem;
    color: var(--success-color);
}

.link-box {
    display: flex;
    gap: 0.75rem;
}

.link-box input {
    flex: 1;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem;
    color: var(--text-color);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.link-box input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Gallery */
.gallery {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 2rem;
}

.gallery-item {
    background: var(--card-bg);
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
    min-height: 250px;
    animation: fadeIn 0.5s ease;
}

.gallery-item img {
    width: 100%;
    display: block;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.gallery-item img.loaded {
    opacity: 1;
}

.loader-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    z-index: 1;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Footer */
footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

/* Responsive */
@media (max-width: 768px) {
    body {
        align-items: flex-start;
    }

    .container {
        padding: 1rem;
        min-height: 100vh;
    }

    header {
        margin-bottom: 2rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .drop-zone {
        padding: 2rem 1rem;
    }

    .link-box {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .gallery-item {
        min-height: 200px;
    }
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .remove-btn {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 1.5rem;
    height: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.actions {
    margin-top: 2rem;
    text-align: center;
}

.btn {
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    font-size: 1rem;
}

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

.btn.primary:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
}

.btn.primary:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
    transform: none;
}

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

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

.progress-container {
    margin-top: 2rem;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 0.5rem;
    background-color: var(--border-color);
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background-color: var(--accent-color);
    width: 0%;
    transition: width 0.3s ease;
}

.result-container {
    margin-top: 3rem;
    padding: 2rem;
    background-color: var(--card-bg);
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    text-align: center;
}

.result-container h3 {
    margin-bottom: 1.5rem;
}

.link-box {
    display: flex;
    gap: 0.5rem;
}

.link-box input {
    flex: 1;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-family: monospace;
}

footer {
    margin-top: 4rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Gallery styles for view.php */
.gallery {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 3rem;
}

.gallery-item {
    background: var(--card-bg);
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
    min-height: 200px;
}

.gallery-item img {
    width: 100%;
    display: block;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.gallery-item img.loaded {
    opacity: 1;
}

.loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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