:root {
    --accent: #3b82f6;
    --accent-600: #2563eb;
    --success: #16a34a;
    --danger: #dc2626;

    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-2: #f3f4f6;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e5e7eb;

    --radius: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 6px 20px rgba(0,0,0,0.08);

    --duration: 200ms;
    --easing: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1220;
        --surface: #0f172a;
        --surface-2: #111827;
        --text: #e5e7eb;
        --muted: #94a3b8;
        --border: #1f2937;
        --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
        --shadow-md: 0 8px 28px rgba(0,0,0,0.35);
    }
}

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

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 32px;
    line-height: 1.6;
}

.container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 32px;
    width: 100%;
    max-width: 860px;
    margin-top: 12px;
    animation: fade-in var(--duration) var(--easing) both;
}

.header {
    text-align: center;
    margin-bottom: 28px;
}

.header h1 {
    color: var(--text);
    margin-bottom: 6px;
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.header p {
    color: var(--muted);
    font-size: 1rem;
}

.upload-section {
    margin-bottom: 20px;
}

.upload-area {
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 36px 20px;
    text-align: center;
    background: var(--surface-2);
    margin-bottom: 16px;
    transition: border-color var(--duration) var(--easing), background var(--duration) var(--easing), transform var(--duration) var(--easing), box-shadow var(--duration) var(--easing);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--surface-2) 85%, var(--accent));
}

.upload-area.dragover {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--surface-2) 75%, var(--accent));
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}

.upload-text {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 6px;
    font-weight: 600;
}

.upload-subtext {
    color: var(--muted);
    font-size: 0.92rem;
}

.upload-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: transform var(--duration) var(--easing), box-shadow var(--duration) var(--easing), background var(--duration) var(--easing), color var(--duration) var(--easing), border-color var(--duration) var(--easing);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    justify-content: center;
    background: var(--surface);
    color: var(--text);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-600);
    border-color: var(--accent-600);
}

.btn-success {
    background: color-mix(in srgb, var(--success) 92%, black 0%);
    border-color: color-mix(in srgb, var(--success) 92%, black 0%);
    color: #fff;
}

.btn-success:hover:not(:disabled) {
    background: color-mix(in srgb, var(--success) 100%, black 0%);
    border-color: color-mix(in srgb, var(--success) 100%, black 0%);
}

.btn-danger {
    background: color-mix(in srgb, var(--danger) 95%, black 0%);
    border-color: color-mix(in srgb, var(--danger) 95%, black 0%);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: color-mix(in srgb, var(--danger) 100%, black 0%);
    border-color: color-mix(in srgb, var(--danger) 100%, black 0%);
}

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

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

.file-list {
    margin-top: 20px;
}

.file-item {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform var(--duration) var(--easing), box-shadow var(--duration) var(--easing);
    border: 1px solid var(--border);
}

.file-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.file-preview {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border);
}

.file-details h4 {
    color: var(--text);
    margin-bottom: 4px;
    font-size: 1rem;
    font-weight: 600;
}

.file-details p {
    color: var(--muted);
    font-size: 0.9rem;
}

.file-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.file-actions .btn {
    padding: 8px 14px;
    font-size: 0.9rem;
    min-width: auto;
}

.progress-container {
    width: 100%;
    margin-top: 12px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 80%, white));
    width: 0%;
    transition: width 0.25s var(--easing);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
    animation: shimmer 1.7s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.status {
    padding: 12px;
    border-radius: 10px;
    margin-top: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.status.success {
    border-color: color-mix(in srgb, var(--success) 30%, var(--border));
    background: color-mix(in srgb, var(--success) 8%, var(--surface-2));
    color: color-mix(in srgb, var(--success) 60%, var(--text));
}

.status.error {
    border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
    background: color-mix(in srgb, var(--danger) 8%, var(--surface-2));
    color: color-mix(in srgb, var(--danger) 60%, var(--text));
}

.status.loading {
    border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
    background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
    color: color-mix(in srgb, var(--accent) 60%, var(--text));
}

.url-display {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    margin-top: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    word-break: break-all;
    position: relative;
}

.url-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.upload-results {
    margin-top: 24px;
}

.results-summary {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.results-summary h3 {
    color: var(--text);
    margin-bottom: 10px;
    font-size: 1.15rem;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.stat-item {
    text-align: center;
    padding: 12px;
    background: var(--surface-2);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.stat-number {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 14px;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    z-index: 1000;
    animation: slideIn var(--duration) var(--easing);
}

.notification.success { background: var(--success); }
.notification.error { background: var(--danger); }

@keyframes slideIn {
    from { transform: translateY(-8px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.uploaded-files-section {
    margin-top: 28px;
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

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

.section-header h2 {
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
}

.uploaded-files-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.uploaded-file-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    transition: transform var(--duration) var(--easing), box-shadow var(--duration) var(--easing);
    position: relative;
    overflow: hidden;
}

.uploaded-file-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.uploaded-file-image {
    width: 100%;
    height: 172px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
}

.uploaded-file-info h4 {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
    word-break: break-all;
}

.uploaded-file-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 10px;
}

.uploaded-file-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.uploaded-file-actions .btn {
    padding: 6px 10px;
    font-size: 0.82rem;
    min-width: auto;
    flex: 1;
}

.url-preview {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    margin: 8px 0 10px 0;
    font-family: monospace;
    font-size: 0.78rem;
    word-break: break-all;
    color: var(--muted);
    cursor: pointer;
    transition: background var(--duration) var(--easing), border-color var(--duration) var(--easing);
}

.url-preview:hover {
    background: color-mix(in srgb, var(--surface-2) 85%, var(--accent));
    border-color: var(--accent);
}

.loading-skeleton {
    background: linear-gradient(90deg, color-mix(in srgb, var(--surface-2) 85%, black 0%) 25%, color-mix(in srgb, var(--surface-2) 70%, black 0%) 50%, color-mix(in srgb, var(--surface-2) 85%, black 0%) 75%);
    background-size: 200% 100%;
    animation: loading 1.3s infinite;
    border-radius: var(--radius);
    height: 200px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.empty-state {
    text-align: center;
    padding: 32px 20px;
    color: var(--muted);
}

/* Responsive */
@media (max-width: 768px) {
    body { padding: 16px; }
    .container { padding: 20px; margin-top: 8px; }
    .header h1 { font-size: 1.6rem; }
    .upload-area { padding: 28px 16px; }
    .file-item { flex-direction: column; gap: 12px; text-align: center; }
    .file-info { flex-direction: column; text-align: center; }
    .file-actions { width: 100%; justify-content: center; }
    .upload-controls { flex-direction: column; align-items: center; }
    .btn { width: 100%; max-width: 300px; }
    .uploaded-files-list { grid-template-columns: 1fr; }
    .section-header { flex-direction: column; gap: 12px; text-align: center; }
    .uploaded-file-actions { flex-direction: column; }
    .uploaded-file-actions .btn { flex: none; }
}

/* Motion accessibility */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

@keyframes fade-in { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: translateY(0);} }

/* KNOWHY Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background-color: #ffffff;
    margin: 15% auto;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
    position: relative;
    animation: slideIn 0.3s ease-out;
}

.modal-header {
    position: relative;
    padding: 15px 20px 0;
    text-align: right;
}

.close-modal {
    color: #999;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.close-modal:hover,
.close-modal:focus {
    color: #333;
}

.modal-body {
    padding: 20px 40px 40px;
    text-align: center;
}

.modal-body h2 {
    margin: 0;
    color: #333;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

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

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
} 