:root {
    /* Default Theme (Dark Purple) */
    --primary: #6c5ce7;
    --primary-hover: #5b4cc4;
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #10b981;
    --error: #ef4444;
}

/* Theme: Ocean Blue */
body.theme-ocean {
    --primary: #0ea5e9;
    --primary-hover: #0284c7;
    --bg: #0c4a6e;
    --card-bg: #075985;
    --text: #f0f9ff;
    --text-muted: #bae6fd;
    --border: #38bdf8;
    --success: #34d399;
}

/* Theme: Forest Green */
body.theme-forest {
    --primary: #22c55e;
    --primary-hover: #16a34a;
    --bg: #052e16;
    --card-bg: #14532d;
    --text: #dcfce7;
    --text-muted: #86efac;
    --border: #4ade80;
    --success: #84cc16;
}

/* Theme: Sunset Orange */
body.theme-sunset {
    --primary: #f97316;
    --primary-hover: #ea580c;
    --bg: #431407;
    --card-bg: #7c2d12;
    --text: #ffedd5;
    --text-muted: #fdba74;
    --border: #fb923c;
    --success: #eab308;
}

/* Theme: Light Clean */
body.theme-light {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --text: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --success: #059669;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    /* Using min-height to handle content overflow on small screens */
    margin: 0;
    padding: 20px;
    /* Safe area for mobile */
}

.container {
    width: 100%;
    max-width: 480px;
    text-align: center;
}

header {
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
}

.card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
}

.tabs {
    display: flex;
    background: var(--bg);
    padding: 5px;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 10px;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s;
}

.tab-btn.active {
    background-color: var(--card-bg);
    color: var(--primary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 3rem 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background-color: rgba(108, 92, 231, 0.05);
}

.upload-area .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Progress */
.hidden {
    display: none !important;
}

#upload-progress {
    margin-top: 2rem;
}

.progress-bar {
    height: 8px;
    background-color: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.fill {
    height: 100%;
    background-color: var(--primary);
    width: 0%;
    transition: width 0.2s;
}

/* Result */
.pin-display {
    font-size: 4rem;
    font-weight: 700;
    color: var(--success);
    letter-spacing: 5px;
    margin: 1rem 0;
    font-variant-numeric: tabular-nums;
}

.note {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.btn {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
    width: 100%;
    font-size: 1rem;
}

.btn:hover {
    background-color: var(--primary-hover);
}

.download-btn {
    background-color: var(--success);
}

.download-btn:hover {
    background-color: #059669;
}

/* Input */
.input-group {
    margin-bottom: 1.5rem;
    text-align: right;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.pin-input-wrapper input {
    width: 100%;
    background-color: var(--bg);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 8px;
    color: var(--text);
    font-size: 2rem;
    text-align: center;
    letter-spacing: 10px;
    font-family: monospace;
}

.pin-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
}

.file-card {
    background-color: var(--bg);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
    text-align: right;
}

.file-card .icon {
    font-size: 2rem;
    background: var(--card-bg);
    padding: 0.5rem;
    border-radius: 8px;
}

.file-card .details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#file-name {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#file-size {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.error {
    color: var(--error);
    margin-top: 1rem;
}

.pin-display-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 2.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background 0.2s;
}

.icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.designer {
    margin-top: 0.5rem;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--primary);
    opacity: 0.8;
}