/**
 * سامانه راه رشد - استایل‌های متریال دیزاین ۳ (Google Material You / M3)
 * Modern Material 3 UI with Local Vazirmatn Font
 */

/* ==========================================================================
   ۱. بارگذاری محلی و سراسری فونت وزیرمتن (Complete Local Vazirmatn Font)
   ========================================================================== */

/* Vazirmatn Arabic & Latin Subsets (Local Files) */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn-arabic-300-normal.woff2') format('woff2'),
         url('../fonts/vazirmatn-arabic-300-normal.woff') format('woff');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+08A0-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn-latin-300-normal.woff2') format('woff2'),
         url('../fonts/vazirmatn-latin-300-normal.woff') format('woff');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn-arabic-400-normal.woff2') format('woff2'),
         url('../fonts/vazirmatn-arabic-400-normal.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+08A0-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn-latin-400-normal.woff2') format('woff2'),
         url('../fonts/vazirmatn-latin-400-normal.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn-arabic-500-normal.woff2') format('woff2'),
         url('../fonts/vazirmatn-arabic-500-normal.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+08A0-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn-latin-500-normal.woff2') format('woff2'),
         url('../fonts/vazirmatn-latin-500-normal.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn-arabic-600-normal.woff2') format('woff2'),
         url('../fonts/vazirmatn-arabic-600-normal.woff') format('woff');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+08A0-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn-latin-600-normal.woff2') format('woff2'),
         url('../fonts/vazirmatn-latin-600-normal.woff') format('woff');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn-arabic-700-normal.woff2') format('woff2'),
         url('../fonts/vazirmatn-arabic-700-normal.woff') format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+08A0-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn-latin-700-normal.woff2') format('woff2'),
         url('../fonts/vazirmatn-latin-700-normal.woff') format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn-arabic-800-normal.woff2') format('woff2'),
         url('../fonts/vazirmatn-arabic-800-normal.woff') format('woff');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+08A0-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn-latin-800-normal.woff2') format('woff2'),
         url('../fonts/vazirmatn-latin-800-normal.woff') format('woff');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* نام مستعار Vazir برای سازگاری */
@font-face {
    font-family: 'Vazir';
    src: url('../fonts/vazirmatn-arabic-400-normal.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

/* ==========================================================================
   ۲. متغیرهای سیستم طراحی متریال ۳ گوگل (M3 Design Tokens)
   ========================================================================== */
:root {
    /* M3 Color System */
    --md-sys-color-primary: #79266E;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #ffd7f3;
    --md-sys-color-on-primary-container: #370031;
    --md-sys-color-secondary: #6e5868;
    --md-sys-color-surface: #ffffff;
    --md-sys-color-surface-dim: #ded8e1;
    --md-sys-color-surface-bright: #fef7ff;
    --md-sys-color-surface-container: #f7f2fa;
    --md-sys-color-surface-container-high: #ece6f0;
    --md-sys-color-on-surface: #1d1b20;
    --md-sys-color-on-surface-variant: #49454f;
    --md-sys-color-outline: #79747e;
    --md-sys-color-outline-variant: #cac4d0;
    --md-sys-color-error: #ba1a1a;
    --md-sys-color-error-container: #ffdad6;
    --md-sys-color-on-error: #ffffff;
    --md-sys-color-accent-blue: #007bff;
    
    /* M3 Elevation & Shadows */
    --md-sys-elevation-1: 0 1px 3px 1px rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.12);
    --md-sys-elevation-2: 0 2px 6px 2px rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.12);
    --md-sys-elevation-3: 0 4px 12px 3px rgba(0, 0, 0, 0.08), 0 1px 3px 0 rgba(0, 0, 0, 0.12);
    
    /* M3 Shape / Radii */
    --md-shape-corner-small: 8px;
    --md-shape-corner-medium: 16px;
    --md-shape-corner-large: 24px;
    --md-shape-corner-extra-large: 28px;
    --md-shape-corner-full: 9999px;
    
    --font-family: 'Vazirmatn', 'Vazir', Tahoma, sans-serif;
    --transition-standard: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

/* ==========================================================================
   ۳. تنظیمات پایه و اجباری فونت وزیرمتن (Universal Font & Base Reset)
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body, button, input, select, textarea, optgroup, table, th, td, code, kbd, samp, pre {
    font-family: var(--font-family) !important;
}

body {
    font-family: var(--font-family);
    direction: rtl;
    text-align: right;
    background-color: #eeeeee;
    color: var(--md-sys-color-on-surface);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* پس‌زمینه تمیز متریال */
.m3-bg-glow,
.m3-bg-glow-bottom {
}


/* ==========================================================================
   ۴. کارت ورود متریال دیزاین ۳ (M3 Elevated Card)
   ========================================================================== */
.m3-card-wrapper {
    width: 100%;
    max-width: 430px;
    background-color: var(--md-sys-color-surface);
    border-radius: var(--md-shape-corner-extra-large);
    box-shadow: var(--md-sys-elevation-3);
    padding: 40px 36px;
    position: relative;
    z-index: 10;
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: var(--transition-standard);
}

/* لوگو در بالای فرم */
.m3-logo-box {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
}

.m3-logo-img {
    max-width: 290px;
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

/* عناوین متریال ۳ */
.m3-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--md-sys-color-on-surface);
    text-align: center;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.m3-subtitle {
    font-size: 0.88rem;
    color: var(--md-sys-color-on-surface-variant);
    text-align: center;
    margin-bottom: 28px;
    font-weight: 400;
}

/* باکس اطلاعیه اختیاری (تنظیم‌پذیر از ادمین) */
.m3-notice-banner {
    background-color: #fff1f2;
    border: 1px solid #ffe4e6;
    border-radius: var(--md-shape-corner-medium);
    padding: 16px;
    margin-bottom: 24px;
    color: #9f1239;
    font-size: 0.86rem;
    line-height: 1.75;
}

.m3-notice-title {
    font-weight: 700;
    font-size: 0.94rem;
    display: block;
    margin-bottom: 4px;
}

.m3-notice-body {
    margin-bottom: 6px;
}

.m3-notice-note {
    font-size: 0.82rem;
    opacity: 0.95;
    font-weight: 600;
}

/* ==========================================================================
   ۵. فیلد ورودی متریال ۳ (M3 Outlined Text Field)
   ========================================================================== */
.m3-text-field {
    position: relative;
    margin-bottom: 20px;
}

.m3-field-container {
    position: relative;
    display: flex;
    align-items: center;
    border: 1.5px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-shape-corner-medium);
    background: transparent;
    transition: var(--transition-standard);
    height: 56px;
    padding: 0 16px;
}

.m3-field-container:hover {
    border-color: var(--md-sys-color-outline);
}

.m3-field-container:focus-within {
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    box-shadow: 0 0 0 4px rgba(121, 38, 110, 0.08);
}

.m3-field-icon {
    width: 22px;
    height: 22px;
    color: var(--md-sys-color-outline);
    margin-left: 12px;
    flex-shrink: 0;
    transition: var(--transition-standard);
}

.m3-field-container:focus-within .m3-field-icon {
    color: var(--md-sys-color-primary);
}

.m3-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-family: var(--font-family);
    font-size: 1.05rem;
    color: var(--md-sys-color-on-surface);
    letter-spacing: 0.5px;
    text-align: right;
}

.m3-input::placeholder {
    color: var(--md-sys-color-outline);
    font-size: 0.92rem;
    font-weight: 400;
}

/* ==========================================================================
   ۶. سوئیچ متریال ۳ (M3 Switch Component)
   ========================================================================== */
.m3-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    cursor: pointer;
    user-select: none;
}

.m3-switch-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.m3-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 32px;
}

.m3-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.m3-switch-track {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--md-sys-color-surface-container-high);
    border: 2px solid var(--md-sys-color-outline);
    border-radius: var(--md-shape-corner-full);
    transition: var(--transition-standard);
}

.m3-switch-track:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 6px;
    bottom: 6px;
    background-color: var(--md-sys-color-outline);
    border-radius: 50%;
    transition: var(--transition-standard);
}

.m3-switch input:checked + .m3-switch-track {
    background-color: var(--md-sys-color-primary);
    border-color: var(--md-sys-color-primary);
}

.m3-switch input:checked + .m3-switch-track:before {
    transform: translateX(20px);
    background-color: var(--md-sys-color-on-primary);
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
}

/* ==========================================================================
   ۷. دکمه متریال ۳ (M3 Filled Pill Button)
   ========================================================================== */
.m3-btn-filled {
    width: 100%;
    height: 48px;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    border-radius: var(--md-shape-corner-full);
    font-family: var(--font-family);
    font-size: 1.02rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--md-sys-elevation-1);
    transition: var(--transition-standard);
    position: relative;
    overflow: hidden;
}

.m3-btn-filled:hover {
    background-color: #641c59;
    box-shadow: var(--md-sys-elevation-2);
    transform: translateY(-1px);
}

.m3-btn-filled:active {
    transform: translateY(0);
    box-shadow: var(--md-sys-elevation-1);
}

.m3-btn-filled:disabled {
    background-color: var(--md-sys-color-surface-dim);
    color: var(--md-sys-color-outline);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* لودینگ متریال */
.m3-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: m3-spin 0.75s linear infinite;
}

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

/* فوتر کارت */
.m3-footer-row {
    margin-top: 24px;
    text-align: center;
    font-size: 0.88rem;
    color: var(--md-sys-color-on-surface-variant);
}

.m3-link {
    color: #15803d;
    text-decoration: none;
    font-weight: 600;
    margin-right: 4px;
    transition: var(--transition-standard);
}

.m3-link:hover {
    text-decoration: underline;
    color: #166534;
}

/* هشدارهای متریال ۳ */
.m3-alert {
    padding: 12px 16px;
    border-radius: var(--md-shape-corner-medium);
    font-size: 0.88rem;
    margin-bottom: 20px;
    display: none;
    line-height: 1.6;
    animation: m3-fade 0.25s ease;
}

.m3-alert-error {
    background-color: var(--md-sys-color-error-container);
    color: #410002;
    border: 1px solid #ffdad6;
}

.m3-alert-success {
    background-color: #dcfce7;
    color: #14532d;
    border: 1px solid #bbf7d0;
}

@keyframes m3-fade {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
    body {
        padding: 16px 12px;
    }
    .m3-card-wrapper {
        padding: 32px 22px;
        border-radius: 20px;
    }
    .m3-logo-img {
        max-width: 250px;
    }
    .m3-title {
        font-size: 1.3rem;
    }
}
