:root {
    --bg-primary: #0a0a0b;
    --bg-secondary: #121214;
    --bg-card: #18181b;
    --bg-hover: #1f1f23;
    --border-color: #27272a;
    --border-accent: #3f3f46;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent-green: #22c55e;
    --accent-green-dim: rgba(34, 197, 94, 0.15);
    --accent-blue: #3b82f6;
    --accent-blue-dim: rgba(59, 130, 246, 0.15);
    --accent-purple: #a855f7;
    --accent-purple-dim: rgba(168, 85, 247, 0.15);
    --accent-orange: #f97316;
    --accent-orange-dim: rgba(249, 115, 22, 0.15);
    --accent-red: #FB2E4C;
    --accent-red-dim: rgba(251, 46, 76, 0.15);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Logo */
.app-logo {
    width: 32px;
    height: 46px;
    flex-shrink: 0;
}

.app-logo-large {
    width: 56px;
    height: 80px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

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

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 8px;
}

.modal-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
    font-size: 14px;
}

.pin-input-group {
    margin-bottom: 24px;
}

.pin-input-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pin-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    letter-spacing: 4px;
    text-align: center;
    transition: all 0.2s ease;
}

.pin-input:focus {
    outline: none;
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px var(--accent-red-dim);
}

.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #FB2E4C, #FE7237);
    border: none;
    border-radius: 10px;
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(251, 46, 76, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pin-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-secondary);
}

.pin-badge .dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Refresh Button */
.btn-refresh {
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-refresh:hover {
    background: var(--bg-hover);
    border-color: var(--border-accent);
    color: var(--text-primary);
}

.btn-refresh:active {
    transform: scale(0.95);
}

.btn-refresh.spinning svg {
    animation: spin 0.8s linear infinite;
}

/* Pagination */
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-page {
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

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

.btn-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: 6px;
    min-width: 70px;
    text-align: center;
}

/* Main Content */
.main-content {
    padding: 24px;
    max-width: 1600px;
    margin: 0 auto;
}

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

.section-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Grid */
.wallpapers-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Wallpaper Card */
.wallpaper-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.wallpaper-card:hover {
    border-color: var(--border-accent);
}

.card-header {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.original-preview {
    position: relative;
    width: 60px;
    height: 120px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-primary);
    flex-shrink: 0;
}

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

.original-preview:hover .download-overlay {
    opacity: 1;
}

/* Download overlay for original image */
.download-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: pointer;
}

.download-overlay svg {
    width: 24px;
    height: 24px;
    color: white;
}

.wallpaper-id {
    position: absolute;
    bottom: 4px;
    left: 4px;
    right: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 8px;
    padding: 2px 4px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 4px;
    color: var(--text-muted);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

.card-title {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Category Select */
.category-select-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.category-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-select {
    padding: 8px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
    max-width: 180px;
}

.category-select:hover {
    border-color: var(--border-accent);
}

.category-select:focus {
    outline: none;
    border-color: var(--accent-red);
}

/* Card Body */
.card-body {
    padding: 12px;
}

.uploads-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

/* Upload Cells */
.upload-cell {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.upload-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

.platform-badge {
    font-size: 9px;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.platform-badge.android {
    background: var(--accent-green-dim);
    color: var(--accent-green);
}

.platform-badge.ios {
    background: var(--accent-blue-dim);
    color: var(--accent-blue);
}

.platform-badge.video-ios {
    background: var(--accent-purple-dim);
    color: var(--accent-purple);
}

.platform-badge.xiaomi {
    background: var(--accent-orange-dim);
    color: var(--accent-orange);
}

.upload-area {
    position: relative;
    aspect-ratio: 1 / 2;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    background: var(--bg-secondary);
}

.upload-area:hover {
    border-color: var(--border-accent);
    background: var(--bg-hover);
}

.upload-area.dragover {
    border-color: var(--accent-blue);
    background: var(--accent-blue-dim);
}

.upload-area.has-preview {
    border-style: solid;
    border-color: var(--accent-green);
}

.upload-area.uploading {
    pointer-events: none;
}

.upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.upload-text {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    padding: 0 4px;
}

.preview-thumbnail,
.preview-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--accent-blue);
    transition: width 0.3s ease;
}

.upload-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    font-size: 12px;
    font-weight: 500;
}

.upload-status.success {
    color: var(--accent-green);
}

.upload-status.error {
    color: var(--accent-red);
}

/* Loading */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    color: var(--text-muted);
}

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

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

/* Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1001;
}

.toast {
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    max-width: 360px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-color: var(--accent-green);
}

.toast.error {
    border-color: var(--accent-red);
}

.toast-icon {
    font-size: 18px;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 0;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .header {
        flex-wrap: wrap;
    }
    
    .header-title {
        font-size: 16px;
    }

    .uploads-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .main-content {
        padding: 16px;
    }
}

/* Responsive - Mobile */
@media (max-width: 600px) {
    .header {
        padding: 12px 16px;
    }

    .header-left {
        flex: 1;
    }

    .header-title {
        font-size: 14px;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .pagination-controls {
        gap: 6px;
    }

    .btn-page {
        padding: 6px 10px;
        font-size: 12px;
    }

    .btn-page span {
        display: none;
    }

    .page-info {
        font-size: 11px;
        padding: 6px 10px;
        min-width: auto;
    }

    .pin-badge {
        font-size: 11px;
        padding: 6px 10px;
    }

    .section-header {
        text-align: center;
    }

    .card-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .original-preview {
        width: 100px;
        height: 200px;
    }

    .card-info {
        align-items: center;
        width: 100%;
    }

    .category-select {
        max-width: 100%;
        width: 100%;
    }

    .uploads-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .modal-content {
        padding: 24px;
    }

    .modal-title {
        font-size: 20px;
    }

    .toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }

    .toast {
        max-width: 100%;
    }
}
