/* Modern CSS with SVG animations, light/dark theme (dark default) */

:root {
    /* Dark theme (default) */
    --bg: #0a0a0a;
    --bg-subtle: #121212;
    --bg-elevated: #1a1a1a;
    --bg-hover: #2a2a2a;
    --text: #e0e0e0;
    --text-muted: #666666;
    --text-on-dark: #ffffff;
    --primary: #00d4aa;
    --primary-hover: #00f5c4;
    --accent: #ff6b6b;
    --accent-hover: #ff8c8c;
    --card: #1a1a1a;
    --border: #333333;
    --success: #00d4aa;
    --warning: #ffa502;
    --error: #ff6b6b;
}

/* Light theme (optional, can be toggled) */
body.light-theme {
    --bg: #f8f9fa;
    --bg-subtle: #ffffff;
    --bg-elevated: #ffffff;
    --bg-hover: #e9ecef;
    --text: #212529;
    --text-muted: #666666;
    --text-on-dark: #000000;
    --primary: #00c896;
    --primary-hover: #00e6b2;
    --accent: #ff6b6b;
    --accent-hover: #ff8c8c;
    --card: #ffffff;
    --border: #dee2e6;
    --success: #00a688;
    --warning: #ffa502;
    --error: #ff6b6b;
}

* {
    box-sizing: border-box;
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

html {
    scroll-behavior: smooth;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

body {
    font-family: 'Shabnam', 'Tahoma', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    min-height: 100vh;
    direction: rtl;
}

/* SVG Animations */
.svg-animate {
    animation: svgFloat 6s ease-in-out infinite;
}

@keyframes svgFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.svg-pulse {
    animation: svgPulse 2s ease-in-out infinite;
}

@keyframes svgPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); }
}

.svg-spin {
    animation: svgSpin 2s linear infinite;
}

@keyframes svgSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.svg-wave {
    animation: svgWave 3s ease-in-out infinite;
}

@keyframes svgWave {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

.svg-float {
    animation: svgFloat 4s ease-in-out infinite;
}

@keyframes svgFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

/* Background SVG patterns
   These are DECORATIVE background layers. They must sit BEHIND the page
   content (negative z-index) and never capture pointer events, otherwise
   they paint on top of the UI and make the page unusable. */
.bg-pattern {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -2;
}
/* keep the inner svg exactly viewport-sized so it cannot overflow */
.bg-pattern svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Decorative floating-element wrappers (inline position:fixed) must also
   live behind the content. */
.bg-decor {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
}

.bg-grid {
    position: fixed;
    inset: 0;
    background-color: var(--border);
    mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 64 64'%3E%3Cpath d='M0 0h32v32H0V0zm32 32h32v32H32V32z'/%3E%3C/svg%3E");
    mask-size: 32px 32px;
    opacity: 0.1;
    background-repeat: repeat;
    pointer-events: none;
    z-index: -2;
}

@media (prefers-color-scheme: light) {
    .bg-grid {
        mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 64 64'%3E%3Cpath d='M0 0h32v32H0V0zm32 32h32v32H32V32z' fill='var(--text-muted)'/%3E%3C/svg%3A");
    }
}

/* Floating decorative elements */
.decorative-float {
    position: absolute;
    animation: decorativeFloat 8s ease-in-out infinite;
}

@keyframes decorativeFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    33% { transform: translateY(-30px) rotate(5deg); }
    66% { transform: translateY(-15px) rotate(-3deg); }
}

/* Card with glowing border */
.glowing-card {
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.glowing-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 30px rgba(0, 212, 170, 0.2);
    transform: translateY(-2px);
}

/* Button styles */
.btn {
    display: inline-block;
    padding: 0.8em 1.5em;
    border-radius: 0.5em;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-family: 'Shabnam', sans-serif;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: var(--bg);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 212, 170, 0.4);
}

.btn-accent {
    background: var(--accent);
    color: var(--bg);
}

.btn-accent:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.btn-success {
    background: var(--success);
    color: var(--bg);
}

.btn-success:hover {
    background: #00f0c5;
    box-shadow: 0 4px 15px rgba(0, 212, 170, 0.4);
}

/* Input styles */
.input {
    width: 100%;
    padding: 0.8em 1em;
    border: 1px solid var(--border);
    border-radius: 0.5em;
    background: var(--bg-elevated);
    color: var(--text);
    font-family: 'Shabnam', sans-serif;
    font-size: 1em;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.15);
}

.input::placeholder {
    color: var(--text-muted);
}

/* Card styles */
.card {
    background: var(--card);
    border-radius: 1em;
    padding: 1.5em;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Notification badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2em 0.6em;
    border-radius: 1em;
    font-size: 0.75em;
    font-weight: 600;
}

.badge-success {
    background: rgba(0, 212, 170, 0.2);
    color: var(--success);
}

.badge-warning {
    background: rgba(255, 165, 2, 0.2);
    color: var(--warning);
}

.badge-error {
    background: rgba(255, 107, 107, 0.2);
    color: var(--error);
}

/* Status indicator */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Loader */
.loader {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    left: -999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-link:focus {
    left: 50%;
    top: 20px;
    width: auto;
    height: auto;
    background: var(--primary);
    color: var(--bg);
    padding: 0.5em;
    border-radius: 2em;
    font-size: 1em;
}

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

.orbit-spin {
    animation: orbitSpin 8s linear infinite;
}

@keyframes orbitSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.bounce {
    animation: bounce 3s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.ripple {
    animation: ripple 4s ease-in-out infinite;
}

@keyframes ripple {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; transform: scale(1.5); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .svg-animate,
    .svg-pulse,
    .svg-spin,
    .svg-wave,
    .svg-float,
    .status-dot,
    .loader {
        animation: none;
    }
    
    .glowing-card:hover {
        transform: none;
    }
    
    .orbit-spin,
    .bounce,
    .ripple {
        animation: none !important;
        transform: none !important;
    }
}
/* ============================================================
   THEME ALIASES
   The markup and the inline theme-toggle script use the class
   names `theme-dark` / `theme-light` on <body>. Map them onto the
   variable sets above (dark remains the default).
   ============================================================ */
body.theme-light {
    --bg: #f8f9fa;
    --bg-subtle: #ffffff;
    --bg-elevated: #ffffff;
    --bg-hover: #e9ecef;
    --text: #212529;
    --text-muted: #666666;
    --text-on-dark: #000000;
    --primary: #00c896;
    --primary-hover: #00e6b2;
    --accent: #ff6b6b;
    --accent-hover: #ff8c8c;
    --card: #ffffff;
    --border: #dee2e6;
    --success: #00a688;
    --warning: #ffa502;
    --error: #ff6b6b;
}
body.light-theme { /* keep old alias working too */
    --bg: #f8f9fa; --bg-subtle: #ffffff; --bg-elevated: #ffffff; --bg-hover: #e9ecef;
    --text: #212529; --text-muted: #666666; --text-on-dark: #000000;
    --primary: #00c896; --primary-hover: #00e6b2; --accent: #ff6b6b; --accent-hover: #ff8c8c;
    --card: #ffffff; --border: #dee2e6; --success: #00a688; --warning: #ffa502; --error: #ff6b6b;
}

/* ============================================================
   COMPATIBILITY / LAYOUT SYSTEM
   The page markup relies on a 12-column flex utility grid plus a set
   of spacing / colour helpers that were dropped in the modernization.
   Restore them here so every page renders correctly.
   ============================================================ */
@font-face {
    font-family: 'shabnam';
    src: url(../font/Shabnam-FD.ttf);
}

.continer { display: flex; flex-wrap: wrap; }
.center-content { place-content: center; }
.center-item { place-items: center; }
.center-all { place-content: center; place-items: center; }

.col-1 {width: 8.33%;} .col-2 {width: 16.66%;} .col-3 {width: 25%;}
.col-4 {width: 33.33%;} .col-5 {width: 41.66%;} .col-6 {width: 50%;}
.col-7 {width: 58.33%;} .col-8 {width: 66.66%;} .col-9 {width: 75%;}
.col-10 {width: 83.33%;} .col-11 {width: 91.66%;} .col-12 {width: 100%;}

.fullscreen { width: 100%; height: 100vh; }

/* margins */
.margin-0_5em{margin:0.5em;} .margin-1em{margin:1em;} .margin-2em{margin:2em;}
.margin-top-0_3em{margin-top:0.3em;} .margin-top-0_5em{margin-top:0.5em;}
.margin-top-0_8em{margin-top:0.8em;} .margin-top-1em{margin-top:1em;}
.margin-top-2em{margin-top:2em;} .margin-top-3em{margin-top:3em;}
.margin-top-4em{margin-top:4em;} .margin-top-5em{margin-top:5em;}
.margin-bottom-0_5em{margin-bottom:0.5em;} .margin-bottom-1em{margin-bottom:1em;}
.margin-bottom-2em{margin-bottom:2em;} .margin-bottom-3em{margin-bottom:3em;}
.margin-left-0_5em{margin-left:0.5em;} .margin-left-1em{margin-left:1em;}
.margin-right-0_5em{margin-right:0.5em;} .margin-right-1em{margin-right:1em;}
.margin-right-2em{margin-right:2em;}
.margin-auto{margin:auto;}

/* paddings */
.padding-0_25em{padding:0.05em;} .padding-0_5em{padding:0.5em;}
.padding-1em{padding:1em;} .padding-2em{padding:2em;} .padding-3em{padding:3em;}
.padding-top-0_5em{padding-top:0.5em;} .padding-top-1em{padding-top:1em;}
.padding-bottom-1em{padding-bottom:1em;} .padding-bottom-2em{padding-bottom:2em;}
.padding-left-1em{padding-left:1em;} .padding-right-1em{padding-right:1em;}

/* radius */
.r-0{border-radius:0;} .r_0_5{border-radius:0.5em;} .r-1em{border-radius:1em;}
.r-100em{border-radius:100em;}

/* typography / misc */
.font-small{font-size:small;} .font-large{font-size:large;}
.font-size-xx_large{font-size:xx-large;}
.text-center{text-align:center;}
.inline-block{display:inline-block;}
.display-none{display:none!important;}

/* helpers used by the modern markup */
.w-100{width:100%;}
.mb-2{margin-bottom:0.75em;}
.input-container{position:relative;width:100%;}
.input-container .icon-svg{position:absolute;top:50%;transform:translateY(-50%);right:0.7em;display:flex;color:var(--text-muted);pointer-events:none;}
.input-container .input{padding-right:2.2em;}
.top-1em{top:1em;} .left-1em{left:1em;}

/* colours */
.bg-transparent{background-color:transparent;}
.bg-blue{background-color:rgb(19,102,141);}
.bg-dark{background-color:var(--card);}
.bg-dark-50{background-color:color-mix(in srgb, var(--card) 60%, transparent);}
.bg-green{background-color:rgb(26,116,56);}
.bg-yellow{background-color:rgb(253,207,0);}
.bg-red{background-color:rgb(173,0,0);}
.bg-legend{background:linear-gradient(90deg,rgb(99,0,82),rgb(113,0,165));}
.bg-img{background:none;}

.color-black{color:#000;} .color-green{color:#08eb4c;} .color-white{color:#fff;}
.color-wite{color:#fff;}

.border-none{border:none;}
.border-green{border:1px solid #06b800;}
.shadow-green{box-shadow:0 0 20px 1px #0474009c;}
.shadow-1{box-shadow:0 0 0.3em 0.07em #000000;}

.blur{backdrop-filter:blur(10px);}

.position-fixed{position:fixed;}
.position-absolute{position:absolute;}
.top-0{top:0;}
.z-index-10{z-index:10;}

.input-clear{background-color:transparent;border:none;}

.form{border:3px dashed #000000;}

.hover1:hover{transform:scale(0.9,0.9);background-color:green;}
.hover2:hover{transform:scale(1.01,1.01);background-color:rgb(39,146,160);}
.hover3:hover{transform:scale(1.01,1.01);background-color:rgb(175,158,0);}

.submit{background-color:rgb(26,116,56);border-radius:1em;padding:1em;color:aliceblue;border:1px solid aliceblue;}

/* details/summary */
summary{cursor:pointer;}

@media only screen and (max-width: 768px) {
    [class*="col-"] { width: 100%; }
    .form{border:none;}
    .pc-display-none{display:flex!important;}
    .res-continer{display:flex!important;flex-wrap:wrap!important;}
    .res-center-item{place-content:center!important;place-items:center!important;}
    .res-center-all{place-content:center;place-items:center;}
    .res-col-1{width:8.33%!important;} .res-col-2{width:16.66%!important;}
    .res-col-3{width:25%!important;} .res-col-4{width:33.33%!important;}
    .res-col-5{width:41.66%!important;} .res-col-6{width:50%!important;}
    .res-col-7{width:58.33%!important;} .res-col-8{width:66.66%!important;}
    .res-col-9{width:75%!important;} .res-col-10{width:83.33%!important;}
    .res-col-11{width:91.66%!important;} .res-col-12{width:100%!important;}
    .res-font-large{font-size:large;}
    .res-text-center{text-align:center;}
    .res-margin-right-0{margin-right:0;}
    .res-margin-top-0_5em{margin-top:0.5em;}
    .res-margin-top-1em{margin-top:1em;}
}

/* Modal popups must be hidden until triggered, so they can never cover the
   page on load (previously they rendered full-screen on top of the UI). */
#buy_panel, #add_fund, #renew_panel, #msg, #report_panel, #msg_p {
    display: none;
}
