@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@200;300;400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@200;300;400;500;600;700;800;900&display=swap');

/* CSS Variables for theming */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warning-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --danger-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);

    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #4facfe;
    --warning-color: #43e97b;
    --danger-color: #fa709a;

    --text-primary: #2d3748;
    --text-secondary: #718096;
    --text-light: #a0aec0;

    --bg-primary: #ffffff;
    --bg-secondary: #f7fafc;
    --bg-tertiary: #edf2f7;

    --border-radius: 16px;
    --border-radius-lg: 24px;
    --border-radius-xl: 32px;

    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--primary-gradient);
    min-height: 100vh;
    direction: rtl;
    text-align: right;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

/* Vibrant Header */
.vibrant-header {
    position: relative;
    padding: 60px 0 40px;
    text-align: center;
    overflow: hidden;
}

.header-content {
    position: relative;
    z-index: 2;
}

.vibrant-header h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    animation: glow 2s ease-in-out infinite alternate;
}

.vibrant-header h1 i {
    margin-left: 15px;
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;
    animation: pulse 2s infinite;
}

.vibrant-header p {
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Floating Shapes Animation */
.floating-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 6s ease-in-out infinite;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.shape-1 {
    width: 80px;
    height: 80px;
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.shape-2 {
    width: 120px;
    height: 120px;
    top: 60%;
    right: 10%;
    animation-delay: 1.5s;
}

.shape-3 {
    width: 60px;
    height: 60px;
    top: 40%;
    left: 80%;
    animation-delay: 3s;
}

.shape-4 {
    width: 100px;
    height: 100px;
    top: 80%;
    left: 50%;
    animation-delay: 4.5s;
}

/* Main Content */
.main-content {
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    padding: 40px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-2xl);
    position: relative;
    z-index: 2;
}

/* Form Container */
.form-container {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

/* Form Sections */
.form-section {
    margin-bottom: 30px;
    padding: 25px;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.form-section:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.form-section h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section h3 i {
    font-size: 1.2rem;
    color: var(--secondary-color);
}

/* Form Rows */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    font-family: 'Tajawal', sans-serif;
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.form-group input,
.form-group select {
    font-family: 'Tajawal', sans-serif;
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--bg-tertiary);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    direction: ltr;
    text-align: left;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

/* Theme Preview */
.theme-preview {
    margin-top: 30px;
    padding: 25px;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.theme-preview h4 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.theme-samples {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.theme-sample {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.theme-sample:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.theme-sample.active {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.05);
}

.sample-color {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid var(--bg-primary);
    box-shadow: var(--shadow-sm);
}

.theme-sample span {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Generate Button */
.btn-generate {
    font-family: 'Tajawal', sans-serif;
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 18px 40px;
    border-radius: var(--border-radius-lg);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.btn-generate::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: var(--transition-slow);
}

.btn-generate:hover::before {
    left: 100%;
}

.btn-generate:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

.btn-generate:active {
    transform: translateY(-1px);
}

/* Error Message */
.error-message {
    background: var(--danger-gradient);
    color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border-right: 4px solid #e53e3e;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
}

/* QR Result */
.qr-result {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.result-header h2 {
    color: var(--text-primary);
    margin-bottom: 0;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-header h2 i {
    color: var(--success-color);
}

.result-info {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.theme-badge,
.style-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.theme-badge {
    background: var(--primary-gradient);
    color: white;
}

.style-badge {
    background: var(--success-gradient);
    color: white;
}

/* QR Code Display */
.qr-code-display {
    margin-bottom: 25px;
    padding: 30px;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    display: inline-block;
}

.qr-image {
    max-width: 300px;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.qr-image:hover {
    transform: scale(1.05);
}

.svg-container {
    display: inline-block;
    max-width: 300px;
    height: auto;
}

.svg-container svg {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.svg-container svg:hover {
    transform: scale(1.05);
}

/* QR Actions */
.qr-actions {
    margin-top: 25px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-download,
.btn-copy,
.btn-share {
    font-family: 'Tajawal', sans-serif;
    background: var(--success-gradient);
    color: rgb(22, 22, 22);
    text-decoration: none;
    padding: 12px 25px;
    border-radius: var(--border-radius);
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: var(--shadow-md);
}

.btn-download:hover,
.btn-copy:hover,
.btn-share:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-copy {
    background: var(--warning-gradient);
}

.btn-share {
    background: var(--danger-gradient);
}

/* Statistics */
.statistics {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: var(--border-radius-lg);
    margin-top: 30px;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.statistics h3 {
    color: var(--text-primary);
    margin-bottom: 25px;
    text-align: center;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.statistics h3 i {
    color: var(--primary-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: center;
}

.stat-item {
    text-align: center;
    padding: 25px;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.stat-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    color: white;
    font-size: 1.5rem;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
}

.btn-report {
    background: var(--secondary-gradient);
    color: white;
    text-decoration: none;
    padding: 12px 25px;
    border-radius: var(--border-radius);
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-md);
}

.btn-report:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Vibrant Footer */
.vibrant-footer {
    text-align: center;
    color: white;
    padding: 30px 0;
    position: relative;
    z-index: 2;
}

.footer-content {
    opacity: 0.9;
    font-size: .8rem;
}

.footer-content p {
    margin-bottom: 10px;
}

.footer-content a {
    color: #ffffff;
    text-decoration: underline;
    font-weight: 600;
}

.footer-content a:hover {
    opacity: 0.8;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 15px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    transform: translateX(100%);
    transition: var(--transition);
    border-right: 4px solid var(--primary-color);
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    border-right-color: var(--success-color);
}

.notification-error {
    border-right-color: var(--danger-color);
}

.notification i {
    font-size: 1.2rem;
}

.notification-success i {
    color: var(--success-color);
}

.notification-error i {
    color: var(--danger-color);
}

/* Animations */
@keyframes float {

    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

@keyframes glow {
    from {
        text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    }

    to {
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.8), 0 0 30px rgba(255, 255, 255, 0.6);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .main-content {
        padding: 25px;
    }

    .vibrant-header h1 {
        font-size: 2.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .stat-number {
        font-size: 2rem;
    }

    .qr-actions {
        flex-direction: column;
        align-items: center;
    }

    .btn-download,
    .btn-copy,
    .btn-share {
        width: 100%;
        max-width: 250px;
        justify-content: center;
    }

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

    .theme-samples {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
}

@media (max-width: 480px) {
    .vibrant-header h1 {
        font-size: 2rem;
    }

    .main-content {
        padding: 20px;
    }

    .form-container {
        padding: 20px;
    }

    .form-section {
        padding: 20px;
    }

    .qr-image,
    .svg-container {
        max-width: 250px;
    }

    .notification {
        right: 10px;
        left: 10px;
        transform: translateY(-100%);
    }

    .notification.show {
        transform: translateY(0);
    }
}

/* Error Page Styles */
.error-page {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.error-content {
    max-width: 500px;
    padding: 40px;
}

.error-icon {
    font-size: 4rem;
    color: var(--danger-color);
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.error-content h1 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.error-content p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.6;
}

.btn-home {
    background: var(--primary-gradient);
    color: white;
    text-decoration: none;
    padding: 15px 30px;
    border-radius: var(--border-radius);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.btn-home:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Scan Info Page Styles */
.scan-info-page {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

.scan-info-content {
    max-width: 800px;
    width: 100%;
}

.qr-info h1 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 30px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.info-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.info-section h3 {
    font-size: 1.4rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    font-weight: 700;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.info-item .label {
    font-weight: 600;
    color: var(--text-primary);
}

.info-item .value {
    color: var(--text-secondary);
    text-align: left;
}

.info-item .value a {
    color: var(--primary-color);
    text-decoration: none;
    word-break: break-all;
}

.info-item .value a:hover {
    text-decoration: underline;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
    padding: 15px 30px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary {
    background: var(--secondary-gradient);
    color: white;
}

.btn-primary:hover,
.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f7fafc;
        --text-secondary: #e2e8f0;
        --text-light: #a0aec0;
        --bg-primary: #1a202c;
        --bg-secondary: #2d3748;
        --bg-tertiary: #4a5568;
    }
}