:root {
    --primary-color: #006837;
    --secondary-color: #008542;
    --accent-color: #00a651;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #3b82f6;
    
    --background-light: #ffffff;
    --background-dark: #f8fafc;
    --text-light: #1f2937;
    --text-dark: #6b7280;
    --border-light: #e5e7eb;
    --border-dark: #d1d5db;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --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);
    
    --border-radius: 12px;
    --transition: all 0.3s ease;
    
    /* Glassmorphism Variables */
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --glass-backdrop: blur(8px);
    
    /* Gradient Variables */
    --gradient-primary: linear-gradient(135deg, #006837 0%, #008542 50%, #00a651 100%);
    --gradient-secondary: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 50%, #1e40af 100%);
    --gradient-accent: linear-gradient(135deg, #f59e0b 0%, #d97706 50%, #b45309 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%);
    --gradient-background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%);
    --gradient-card: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.8) 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background: var(--gradient-background);
    color: var(--text-light);
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-background);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 99999;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-light);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-dark);
    font-size: 1.125rem;
    font-weight: 600;
}

/* Viewer Container */
.viewer-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 10000;
    display: none;
}

.website-frame {
    width: 100%;
    height: 100%;
    border: none;
}

.ad-overlay {
    position: fixed;
    z-index: 10001;
    background: var(--gradient-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    backdrop-filter: var(--glass-backdrop);
    border: 1px solid var(--glass-border);
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    display: none;
}

.ad-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--error-color);
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    z-index: 10002;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.ad-close:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.ad-content-wrapper {
    padding: 2rem;
}

/* Position Classes */
.pos-top-left { top: 20px; left: 20px; }
.pos-top-center { top: 20px; left: 50%; transform: translateX(-50%); }
.pos-top-right { top: 20px; right: 20px; }
.pos-center-left { top: 50%; left: 20px; transform: translateY(-50%); }
.pos-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.pos-center-right { top: 50%; right: 20px; transform: translateY(-50%); }
.pos-bottom-left { bottom: 20px; left: 20px; }
.pos-bottom-center { bottom: 20px; left: 50%; transform: translateX(-50%); }
.pos-bottom-right { bottom: 20px; right: 20px; }

/* Size Classes */
.size-small { width: 320px; height: 240px; }
.size-medium { width: 480px; height: 360px; }
.size-large { width: 640px; height: 480px; }
.size-fullscreen { 
    width: 100vw !important; 
    height: 100vh !important; 
    top: 0 !important; 
    left: 0 !important; 
    right: 0 !important;
    bottom: 0 !important;
    transform: none !important; 
    border-radius: 0 !important;
    max-width: none !important;
    max-height: none !important;
}

.size-fullscreen .ad-content-wrapper {
    padding: 0;
    width: 100%;
    height: 100%;
}

.size-fullscreen .ad-close {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10003;
}

/* Animation Classes */
.anim-fade { animation: fadeInAnim 0.5s ease; }
.anim-slide-up { animation: slideUpAnim 0.5s ease; }
.anim-slide-down { animation: slideDownAnim 0.5s ease; }
.anim-slide-left { animation: slideLeftAnim 0.5s ease; }
.anim-slide-right { animation: slideRightAnim 0.5s ease; }
.anim-zoom { animation: zoomInAnim 0.5s ease; }

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

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

@keyframes slideDownAnim {
    from { opacity: 0; transform: translateY(-100%); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes zoomInAnim {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

/* Error Container */
.error-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-background);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.error-content {
    text-align: center;
    padding: 2rem;
    background: var(--gradient-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    backdrop-filter: var(--glass-backdrop);
    border: 1px solid var(--glass-border);
    max-width: 500px;
    width: 90%;
}

.error-content i {
    font-size: 4rem;
    color: var(--error-color);
    margin-bottom: 1rem;
}

.error-content h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 2rem;
}

.error-content p {
    color: var(--text-dark);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
}

.btn::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);
}

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

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

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

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--gradient-success);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    transform: translateX(120%);
    transition: var(--transition);
    z-index: 99999;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.toast.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 50%, #b91c1c 100%);
}

.toast.warning {
    background: var(--gradient-accent);
}

.toast.info {
    background: var(--gradient-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .ad-overlay {
        max-width: 95vw;
        max-height: 95vh;
    }

    .ad-content-wrapper {
        padding: 1.5rem;
    }

    .size-small { width: 300px; height: 200px; }
    .size-medium { width: 400px; height: 300px; }
    .size-large { width: 500px; height: 400px; }

    .error-content {
        padding: 1.5rem;
    }

    .error-content h2 {
        font-size: 1.5rem;
    }

    .error-content p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .ad-overlay {
        max-width: 100vw;
        max-height: 100vh;
    }

    .ad-content-wrapper {
        padding: 1rem;
    }

    .size-small { width: 280px; height: 180px; }
    .size-medium { width: 320px; height: 240px; }
    .size-large { width: 360px; height: 280px; }

    .error-content {
        padding: 1rem;
    }

    .error-content i {
        font-size: 3rem;
    }

    .error-content h2 {
        font-size: 1.25rem;
    }

    .error-content p {
        font-size: 0.9rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}