/* ==========================================================
   AWS Student Builder Group - Member Card Generator Styles
   Modern, responsive, RTL-first design system
   ========================================================== */

:root {
    --bg-main: #0a0e17;
    --bg-surface: #121824;
    --bg-surface-glass: rgba(18, 24, 36, 0.85);
    --border-subtle: rgba(255, 255, 255, 0.1);
    --border-focus: #00a4e4;
    
    --aws-squid-ink: #232f3e;
    --aws-smile-orange: #ff9900;
    --aws-blue: #00a4e4;
    --aws-light-blue: #52c8ff;
    --aws-dark-blue: #0073bb;
    
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --shadow-card: 0 25px 60px -15px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
    --shadow-button: 0 8px 24px -4px rgba(0, 164, 228, 0.45);
    --shadow-button-hover: 0 12px 30px -4px rgba(0, 164, 228, 0.65);
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-pill: 9999px;
    
    --font-ar: 'Cairo', system-ui, -apple-system, sans-serif;
    --font-en: 'Outfit', system-ui, -apple-system, sans-serif;
}

/* Reset & Base Setup */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    direction: rtl;
    text-align: right;
    font-family: var(--font-ar);
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

/* Subtle Tech Glow Background */
body::before {
    content: '';
    position: fixed;
    top: -20%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(0, 164, 228, 0.15) 0%, rgba(0, 164, 228, 0) 70%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    bottom: -20%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 153, 0, 0.1) 0%, rgba(255, 153, 0, 0) 70%);
    pointer-events: none;
    z-index: 0;
}

/* App Container */
.app-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 3.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 2rem;
    width: 100%;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    background: rgba(0, 164, 228, 0.12);
    border: 1px solid rgba(0, 164, 228, 0.3);
    border-radius: var(--radius-pill);
    color: var(--aws-light-blue);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

.brand-badge .dot {
    width: 8px;
    height: 8px;
    background: var(--aws-smile-orange);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px var(--aws-smile-orange);
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.card-preview-container {
    width: 100%;
    max-width: 860px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

/* Canvas Wrapper with Modern Framing */
.canvas-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1200 / 627;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-subtle);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.canvas-wrapper:hover {
    box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(0, 164, 228, 0.25);
}

/* The Canvas Element */
#memberCardCanvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: calc(var(--radius-lg) - 1px);
}

/* Canvas Loading Overlay */
.canvas-loading {
    position: absolute;
    inset: 0;
    background: var(--bg-surface-glass);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 1rem;
    z-index: 10;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.canvas-loading.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(0, 164, 228, 0.2);
    border-top-color: var(--aws-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Action Controls */
.actions-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

/* Download Button - Prominent AWS Theme */
.download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.95rem 2.5rem;
    font-family: var(--font-ar);
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, #0073bb 0%, #00a4e4 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-pill);
    cursor: pointer;
    box-shadow: var(--shadow-button);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    user-select: none;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-button-hover);
    background: linear-gradient(135deg, #00609c 0%, #00b4f8 100%);
}

.download-btn:active {
    transform: translateY(1px);
    box-shadow: var(--shadow-button);
}

.download-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.download-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    transition: transform 0.2s ease;
}

.download-btn:hover svg {
    transform: translateY(2px);
}


/* Footer & ClubHub Link */
.app-footer {
    margin-top: auto;
    padding-top: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.clubhub-link {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1.25rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-en);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.clubhub-logo {
    width: 26px;
    height: 26px;
    object-fit: contain;
    /* تحويل الشعار إلى اللون الأبيض النقي بالكامل */
    filter: brightness(0) invert(1);
    opacity: 0.9;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.clubhub-link:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.6);
}

.clubhub-link:hover .clubhub-logo {
    opacity: 1;
    transform: scale(1.08);
}


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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .app-container {
        padding: 1.5rem 1rem 2.5rem;
    }

    .page-title {
        font-size: 1.6rem;
    }

    .page-subtitle {
        font-size: 0.9rem;
    }


    .download-btn {
        width: 100%;
        max-width: 360px;
        font-size: 1.05rem;
        padding: 0.85rem 1.75rem;
    }
}
