/* Variables */
:root {
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --secondary: #EC4899;
    --bg-color: #0F172A;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-color: #F8FAFC;
    --text-muted: #94A3B8;
    --card-hover: rgba(51, 65, 85, 0.8);
    --success: #10B981;
}

/* Global Alert Bar */
.global-alert-bar {
    background: linear-gradient(90deg, var(--primary), #818cf8);
    color: white;
    padding: 10px 0;
    text-align: center;
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.alert-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.alert-link {
    background: white;
    color: var(--primary);
    padding: 2px 12px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: bold;
    margin-right: 10px;
    transition: 0.3s;
}

.alert-link:hover {
    background: var(--bg-dark);
    color: white;
}

@keyframes tada {
    0% {
        transform: scale(1);
    }

    10%,
    20% {
        transform: scale(0.9) rotate(-3deg);
    }

    30%,
    50%,
    70%,
    90% {
        transform: scale(1.1) rotate(3deg);
    }

    40%,
    60%,
    80% {
        transform: scale(1.1) rotate(-3deg);
    }

    100% {
        transform: scale(1) rotate(0);
    }
}

.animate-tada {
    animation: tada 1.5s infinite;
}

/* Reset & Basics */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Dynamic Background Orbs */
.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    filter: blur(100px);
    opacity: 0.6;
    border-radius: 50%;
    animation: float 10s ease-in-out infinite alternate;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: var(--primary);
    animation-delay: 0s;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: var(--secondary);
    animation-delay: 2s;
}

.blob-3 {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    background: #8B5CF6;
    animation-delay: 4s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(50px, 50px) scale(1.1);
    }
}

/* Interface Glassmorphism */
.app-container {
    width: 100%;
    max-width: 500px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    margin: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.app-header {
    text-align: center;
}

.logo-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.logo-area i {
    font-size: 2.5rem;
    color: var(--primary-light);
    filter: drop-shadow(0 0 10px rgba(129, 140, 248, 0.5));
}

.app-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Tabs */
.action-tabs {
    display: flex;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 12px;
    padding: 0.4rem;
    border: 1px solid var(--glass-border);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.8rem 0;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.tab-btn i {
    font-size: 1.2rem;
}

.tab-btn:hover {
    color: var(--text-color);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), #6366F1);
    color: white;
    filter: drop-shadow(0 4px 12px rgba(79, 70, 229, 0.4));
}

.tab-pane {
    display: none;
    animation: tabFadeIn 0.4s ease forwards;
}

.tab-pane.active {
    display: block;
}

@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Upload Box */
.upload-box {
    border: 2px dashed rgba(148, 163, 184, 0.3);
    border-radius: 16px;
    padding: 3rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(15, 23, 42, 0.3);
}

.upload-box:hover {
    border-color: var(--primary-light);
    background: rgba(79, 70, 229, 0.1);
    transform: translateY(-2px);
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary-light);
    margin-bottom: 1rem;
    display: block;
}

.upload-box p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* File Preview Box */
.selected-file-preview {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-color);
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 8px;
    overflow: hidden;
}

.file-details i {
    font-size: 1.5rem;
    color: var(--secondary);
}

.file-details span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Camera */
.camera-container {
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    position: relative;
    aspect-ratio: 4/3;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--glass-border);
    margin-bottom: 1rem;
}

video,
img#camera-snapshot {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-controls {
    display: flex;
    gap: 1rem;
}

/* Inputs & Buttons */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.styled-input {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 1rem;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
    direction: ltr;
    /* Ensure URL is LTR */
}

.styled-input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

.mt-3 {
    margin-top: 1rem;
}

.primary-btn,
.secondary-btn {
    width: 100%;
    padding: 1rem;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    color: white;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.4);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* QR Result */
.result-area {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    text-align: center;
}

.result-title {
    font-size: 1.2rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.text-green {
    color: var(--success);
}

.qr-box {
    background: #fff;
    padding: 1rem;
    border-radius: 12px;
    position: relative;
    width: fit-content;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

#qrcode img {
    display: block;
    margin: 0 auto;
}

.actions-group {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    padding: 0.7rem 1.2rem;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.hidden {
    display: none !important;
}

/* Loader */
.qr-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #1a1a1a;
    font-weight: 600;
    gap: 0.5rem;
    z-index: 10;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 4px solid var(--primary-light);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.share-url-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    word-break: break-all;
    direction: ltr;
    max-width: 100%;
}

/* Ad Banner */
.ad-banner {
    background: rgba(15, 23, 42, 0.4);
    border: 1px dashed var(--text-muted);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Responsiveness */
@media (max-width: 450px) {
    .app-container {
        margin: 1rem;
        padding: 1.5rem;
    }
}