/**
 * SAS Style — کامل و ریسپانسیو
 */

/* ==================== پایه ==================== */
.sas-wrapper {
    direction: rtl;
    font-family: Tahoma, Arial, sans-serif;
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow-x: hidden;
}

.sas-wrapper * { box-sizing: border-box; }

/* ==================== هدر کاربر ==================== */
.sas-user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: #fff;
    padding: 25px 30px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 8px 25px rgba(0,115,170,0.3);
    position: relative;
    overflow: hidden;
    gap: 20px;
}

.sas-user-header-admin {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 50%, #0073aa 100%);
}

.sas-user-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    border-radius: 50%;
    animation: sas-header-pulse 4s ease-in-out infinite;
}

@keyframes sas-header-pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 0.9; }
}

.sas-user-info {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    z-index: 1;
    min-width: 0;
}

.sas-user-avatar {
    width: 70px;
    height: 70px;
    min-width: 70px;
    background: rgba(255,255,255,0.2);
    border: 3px solid rgba(255,255,255,0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    font-weight: bold;
    color: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    animation: sas-avatar-bounce 3s ease-in-out infinite;
}

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

.sas-avatar-text { text-shadow: 0 2px 5px rgba(0,0,0,0.3); }

.sas-user-text { min-width: 0; }

.sas-welcome-title {
    margin: 0 0 5px 0 !important;
    font-size: 1.4em !important;
    color: #fff !important;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.sas-user-name { margin: 0; font-size: 1.1em; opacity: 0.95; }
.sas-user-name strong { color: #fff; font-size: 1.1em; }
.sas-user-role { opacity: 0.85; font-size: 0.9em; margin-right: 8px; }

.sas-header-stats {
    display: flex;
    gap: 15px;
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
}

.sas-mini-stat {
    text-align: center;
    padding: 10px 15px;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    min-width: 90px;
}

.sas-mini-value { display: block; font-size: 1.1em; font-weight: bold; color: #fff; }
.sas-mini-label { display: block; font-size: 0.8em; opacity: 0.85; margin-top: 3px; }

/* ==================== کارت‌های آمار ==================== */
.sas-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.sas-stat-card {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px 15px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sas-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #0073aa, #00a0d2);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.4s ease;
}

.sas-stat-card:hover::before {
    transform: scaleX(1);
    transform-origin: left;
}

.sas-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,115,170,0.15);
    border-color: #0073aa;
}

.sas-stat-icon {
    font-size: 2em;
    margin-bottom: 8px;
    line-height: 1;
}

.sas-stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #0073aa;
    margin-bottom: 5px;
    line-height: 1.1;
}

.sas-stat-label {
    color: #666;
    font-size: 0.85em;
    font-weight: 500;
}

.sas-stat-card.sas-stat-present {
    border-color: #4caf50;
    background: linear-gradient(145deg, #f1f8e9, #e8f5e9);
}
.sas-stat-card.sas-stat-present::before { background: linear-gradient(90deg, #4caf50, #66bb6a); }
.sas-stat-card.sas-stat-present .sas-stat-value { color: #2e7d32; }

.sas-stat-card.sas-stat-absent {
    border-color: #f44336;
    background: linear-gradient(145deg, #ffebee, #ffcdd2);
}
.sas-stat-card.sas-stat-absent::before { background: linear-gradient(90deg, #f44336, #ef5350); }
.sas-stat-card.sas-stat-absent .sas-stat-value { color: #c62828; }

/* ==================== تب‌ها ==================== */
.sas-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 0;
    border-bottom: 2px solid #0073aa;
    position: relative;
    z-index: 10;
}

.sas-tab {
    padding: 12px 22px;
    background: linear-gradient(180deg, #fff 0%, #f0f0f0 100%);
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 0.95em;
    color: #555;
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    white-space: nowrap;
}

.sas-tab:hover:not(.active) {
    background: linear-gradient(180deg, #e8f4fa 0%, #d4ecf7 100%);
    color: #0073aa;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,115,170,0.15);
}

.sas-tab.active {
    background: #0073aa;
    color: #fff;
    font-weight: bold;
    box-shadow: 0 -3px 12px rgba(0,115,170,0.3);
}

.sas-tab.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: sas-shine 0.8s ease-out;
}

@keyframes sas-shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.sas-tab:active:not(.active) {
    transform: translateY(3px) scale(0.96);
}

/* ==================== محتوای تب ==================== */
.sas-tab-content {
    display: none;
    background: #fff;
    padding: 25px;
    border-radius: 0 0 8px 8px;
    border: 1px solid #ddd;
    border-top: none;
    position: relative;
    transform-origin: top center;
    transform-style: preserve-3d;
    perspective: 1400px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow-x: hidden;
}

.sas-tab-content.active {
    display: block;
    animation: sas-book-drop 0.9s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes sas-book-drop {
    0% { opacity: 0; transform: translateY(-300px) rotateX(-90deg) rotateZ(8deg) scale(0.5); }
    15% { opacity: 0.15; transform: translateY(-240px) rotateX(-80deg) rotateZ(6deg) scale(0.6); }
    35% { opacity: 0.4; transform: translateY(-150px) rotateX(-55deg) rotateZ(2deg) scale(0.75); }
    55% { opacity: 0.75; transform: translateY(-50px) rotateX(-25deg) rotateZ(-1deg) scale(0.92); }
    72% { opacity: 1; transform: translateY(20px) rotateX(10deg) rotateZ(1deg) scale(1.04); }
    85% { transform: translateY(-10px) rotateX(-4deg) rotateZ(-0.5deg) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) rotateX(0) rotateZ(0) scale(1); }
}

/* ==================== لودینگ ==================== */
.sas-tab-content.sas-tab-loading {
    position: relative;
    min-height: 300px;
    pointer-events: none;
}

.sas-tab-content.sas-tab-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid #e0e0e0;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: sas-spin 0.8s linear infinite;
    z-index: 100;
}

.sas-tab-content.sas-tab-loading::after {
    content: '📖 در حال بارگذاری...';
    position: absolute;
    top: calc(50% + 50px);
    left: 50%;
    transform: translateX(-50%);
    color: #0073aa;
    font-weight: bold;
    z-index: 100;
    animation: sas-pulse-text 1.2s ease-in-out infinite;
    white-space: nowrap;
}

@keyframes sas-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes sas-pulse-text { 0%,100% { opacity: 0.7; } 50% { opacity: 1; } }

/* ==================== فیلترها ==================== */
.sas-filters-panel {
    background: #f1f8ff;
    border: 1px solid #cce5ff;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.sas-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.sas-form-row label { font-weight: bold; color: #333; font-size: 0.9em; }

.sas-form-row select,
.sas-form-row input[type="text"],
.sas-form-row input[type="email"],
.sas-form-row input[type="password"],
.sas-form-row input[type="number"],
.sas-form-row input[type="time"] {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9em;
    min-width: 150px;
    max-width: 100%;
}

/* ==================== جدول‌ها ==================== */
.sas-attendance-table, .sas-admin-table, .sas-report-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    margin-top: 15px;
    font-size: 0.9em;
}

.sas-attendance-table th, .sas-admin-table th, .sas-report-table th {
    background: #0073aa;
    color: #fff;
    padding: 12px;
    text-align: right;
    font-weight: bold;
}

.sas-attendance-table td, .sas-admin-table td, .sas-report-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

.sas-attendance-table tr:hover, .sas-admin-table tr:hover, .sas-report-table tr:hover {
    background: #f9f9f9;
}

/* ==================== رادیو ==================== */
.sas-status-cell { display: flex; gap: 15px; flex-wrap: wrap; }
.sas-radio { display: flex; align-items: center; gap: 5px; cursor: pointer; padding: 6px 12px; border-radius: 4px; }
.sas-radio.present { background: #e7f7e7; border: 1px solid #b8e0b8; }
.sas-radio.absent { background: #fde8e8; border: 1px solid #f0b8b8; }
.sas-radio input[type="radio"] { margin: 0; }

/* ==================== دکمه‌ها ==================== */
.sas-wrapper button, .sas-wrapper .button, .sas-wrapper input[type="submit"] {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.sas-wrapper button:hover:not(:disabled),
.sas-wrapper .button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,115,170,0.25);
}

.sas-wrapper button:active:not(:disabled),
.sas-wrapper .button:active:not(:disabled) {
    transform: translateY(3px) rotateX(20deg) scale(0.94);
}

.sas-actions-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding: 15px;
    background: #f1f8ff;
    border-radius: 6px;
    border: 1px solid #cce5ff;
    flex-wrap: wrap;
}

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

.sas-panel-header h2 { margin: 0; color: #0073aa; }

/* ==================== اعلان‌ها ==================== */
.sas-notice {
    padding: 12px 15px;
    border-radius: 5px;
    margin: 10px 0;
    font-size: 0.9em;
    animation: sas-notice-slide 0.4s ease-out;
    word-wrap: break-word;
}

@keyframes sas-notice-slide {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.sas-notice.sas-info { background: #e3f2fd; border-right: 4px solid #2196f3; color: #0d47a1; }
.sas-notice.sas-success { background: #e8f5e9; border-right: 4px solid #4caf50; color: #1b5e20; }
.sas-notice.sas-warning { background: #fff3e0; border-right: 4px solid #ff9800; color: #e65100; }
.sas-notice.sas-error { background: #ffebee; border-right: 4px solid #f44336; color: #b71c1c; }

/* ==================== باکس‌ها ==================== */
.sas-box {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
    min-height: 60px;
    overflow-x: auto;
}

.sas-loading { text-align: center; color: #666; padding: 20px; animation: sas-pulse-text 1.2s ease-in-out infinite; }
.sas-empty { text-align: center; color: #999; padding: 30px; font-style: italic; }
.sas-error { color: #d32f2f; font-weight: bold; }

.sas-no-access {
    background: #ffebee;
    color: #b71c1c;
    padding: 20px;
    border-radius: 6px;
    text-align: center;
    border: 1px solid #ef9a9a;
}

/* ==================== Modal ==================== */
.sas-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: sas-fade-in 0.25s ease-out;
    backdrop-filter: blur(3px);
    padding: 15px;
}

@keyframes sas-fade-in { from { opacity: 0; } to { opacity: 1; } }

.sas-modal {
    background: #fff;
    border-radius: 10px;
    padding: 25px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
    animation: sas-modal-pop 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes sas-modal-pop {
    0% { transform: scale(0.6) rotateX(-20deg); opacity: 0; }
    60% { transform: scale(1.05) rotateX(5deg); opacity: 1; }
    100% { transform: scale(1) rotateX(0); opacity: 1; }
}

.sas-modal h3 { margin-top: 0; color: #0073aa; border-bottom: 2px solid #0073aa; padding-bottom: 10px; }
.sas-modal label { display: block; margin: 12px 0 5px; font-weight: bold; color: #333; font-size: 0.9em; }
.sas-modal input, .sas-modal select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95em;
}
.sas-modal-actions { margin-top: 20px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ==================== بج‌ها ==================== */
.sas-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
}
.sas-badge.pending { background: #fff3e0; color: #e65100; }
.sas-badge.sent { background: #e8f5e9; color: #1b5e20; }
.sas-badge.failed { background: #ffebee; color: #b71c1c; }

/* ============================================================
 *          POPUP خوش‌آمد
 * ============================================================ */

.sas-welcome-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, rgba(20,30,48,0.95) 0%, rgba(0,0,0,0.98) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    backdrop-filter: blur(10px);
    animation: sas-overlay-fade-in 0.5s ease-out;
    perspective: 2000px;
    overflow: hidden;
    padding: 15px;
}

.sas-welcome-overlay::before,
.sas-welcome-overlay::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
    pointer-events: none;
}

.sas-welcome-overlay::before {
    background: var(--role-color, #3498db);
    top: -150px;
    right: -150px;
    animation: sas-orb-float 8s ease-in-out infinite;
}

.sas-welcome-overlay::after {
    background: var(--role-color2, #2980b9);
    bottom: -150px;
    left: -150px;
    animation: sas-orb-float 10s ease-in-out infinite reverse;
}

@keyframes sas-orb-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, 30px) scale(1.2); }
}

@keyframes sas-overlay-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sas-welcome-overlay.sas-closing {
    animation: sas-overlay-fade-out 0.5s ease-in forwards;
}

@keyframes sas-overlay-fade-out {
    to { opacity: 0; }
}

.sas-welcome-book {
    display: flex;
    background: linear-gradient(145deg, #ffffff 0%, #f5f7fa 100%);
    border-radius: 25px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow:
        0 40px 100px rgba(0,0,0,0.6),
        0 0 0 1px rgba(255,255,255,0.2) inset,
        0 0 80px var(--role-color, #3498db);
    position: relative;
    animation: sas-book-open-3d 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-style: preserve-3d;
}

@keyframes sas-book-open-3d {
    0% { opacity: 0; transform: rotateY(-180deg) rotateX(20deg) scale(0.3) translateZ(-800px); }
    40% { opacity: 0.5; transform: rotateY(-90deg) rotateX(10deg) scale(0.6) translateZ(-400px); }
    70% { opacity: 0.9; transform: rotateY(15deg) rotateX(-5deg) scale(1.05) translateZ(30px); }
    85% { transform: rotateY(-5deg) rotateX(2deg) scale(0.98) translateZ(0); }
    100% { opacity: 1; transform: rotateY(0) rotateX(0) scale(1) translateZ(0); }
}

.sas-welcome-scene {
    flex: 0 0 45%;
    background: linear-gradient(145deg, var(--role-color, #3498db) 0%, var(--role-color2, #2980b9) 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    perspective: 1000px;
    transform-style: preserve-3d;
    min-height: 300px;
}

.sas-space-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.sas-sp {
    position: absolute;
    width: 6px;
    height: 6px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255,255,255,0.9);
    animation: sas-space-float 6s ease-in-out infinite;
}

.sas-sp:nth-child(1) { top: 15%; left: 20%; animation-delay: 0s; }
.sas-sp:nth-child(2) { top: 25%; right: 25%; animation-delay: 0.8s; width: 4px; height: 4px; }
.sas-sp:nth-child(3) { top: 70%; left: 15%; animation-delay: 1.6s; width: 8px; height: 8px; }
.sas-sp:nth-child(4) { top: 80%; right: 20%; animation-delay: 2.4s; }
.sas-sp:nth-child(5) { top: 50%; left: 50%; animation-delay: 3.2s; width: 5px; height: 5px; }
.sas-sp:nth-child(6) { top: 10%; left: 60%; animation-delay: 4s; width: 7px; height: 7px; }
.sas-sp:nth-child(7) { top: 90%; left: 40%; animation-delay: 4.8s; width: 3px; height: 3px; }
.sas-sp:nth-child(8) { top: 40%; right: 10%; animation-delay: 5.6s; }

@keyframes sas-space-float {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.4; }
    50% { transform: translateY(-40px) scale(1.6); opacity: 1; }
}

.sas-3d-card {
    position: relative;
    width: 180px;
    height: 240px;
    transform-style: preserve-3d;
    animation: sas-card-spin 8s linear infinite;
    z-index: 2;
}

@keyframes sas-card-spin {
    0% { transform: rotateY(0deg) rotateX(10deg); }
    100% { transform: rotateY(360deg) rotateX(10deg); }
}

.sas-3d-face {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.3);
    box-shadow: 0 0 30px rgba(255,255,255,0.3);
    backface-visibility: hidden;
}

.sas-3d-front { transform: translateZ(90px); }
.sas-3d-back { transform: rotateY(180deg) translateZ(90px); }
.sas-3d-right { transform: rotateY(90deg) translateZ(90px); }
.sas-3d-left { transform: rotateY(-90deg) translateZ(90px); }
.sas-3d-top { transform: rotateX(90deg) translateZ(120px); height: 180px; }
.sas-3d-bottom { transform: rotateX(-90deg) translateZ(120px); height: 180px; }

.sas-role-icon-big {
    font-size: 6em;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.3));
    animation: sas-icon-bounce 2s ease-in-out infinite;
}

@keyframes sas-icon-bounce {
    0%, 100% { transform: translateY(0) rotateZ(-5deg); }
    50% { transform: translateY(-10px) rotateZ(5deg); }
}

.sas-floor-glow {
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 30px;
    background: radial-gradient(ellipse, rgba(255,255,255,0.6) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(15px);
    animation: sas-glow-breathe 3s ease-in-out infinite;
}

@keyframes sas-glow-breathe {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.6; }
    50% { transform: translateX(-50%) scale(1.3); opacity: 1; }
}

.sas-welcome-content {
    flex: 1;
    padding: 45px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: right;
    position: relative;
    overflow-y: auto;
}

.sas-welcome-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: linear-gradient(135deg, var(--role-color, #3498db) 0%, var(--role-color2, #2980b9) 100%);
    color: #fff;
    border-radius: 25px;
    font-size: 0.9em;
    font-weight: bold;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    animation: sas-slide-right 0.8s ease-out 0.4s both;
}

.sas-badge-icon { font-size: 1.3em; }

@keyframes sas-slide-right {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

.sas-welcome-name-3d {
    font-size: 2.5em;
    font-weight: bold;
    color: #2c3e50;
    margin: 0 0 15px;
    line-height: 1.2;
    text-shadow: 0 1px 0 #fff, 0 2px 0 #d0d0d0, 0 3px 0 #bbb, 0 4px 5px rgba(0,0,0,0.2);
    animation: sas-name-pop 0.9s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.6s both;
    word-break: break-word;
}

@keyframes sas-name-pop {
    0% { opacity: 0; transform: scale(0.5) rotateX(-90deg); }
    70% { opacity: 1; transform: scale(1.1) rotateX(10deg); }
    100% { opacity: 1; transform: scale(1) rotateX(0); }
}

.sas-welcome-role-3d {
    display: inline-block;
    padding: 10px 25px;
    background: linear-gradient(135deg, var(--role-color, #3498db) 0%, var(--role-color2, #2980b9) 100%);
    color: #fff;
    border-radius: 30px;
    font-size: 1em;
    font-weight: bold;
    margin-bottom: 25px;
    box-shadow: 0 6px 0 rgba(0,0,0,0.15), 0 10px 25px rgba(0,0,0,0.2);
    animation: sas-role-pop 0.9s ease-out 0.8s both;
}

@keyframes sas-role-pop {
    0% { opacity: 0; transform: translateY(-30px) scale(0.8); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.sas-welcome-msg {
    font-size: 1.05em;
    color: #666;
    margin: 0 0 30px;
    line-height: 1.8;
    animation: sas-slide-right 0.9s ease-out 1s both;
}

.sas-welcome-btn-3d {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 40px;
    background: linear-gradient(145deg, var(--role-color, #3498db), var(--role-color2, #2980b9));
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 8px 0 rgba(0,0,0,0.2), 0 12px 25px rgba(0,0,0,0.3), 0 0 40px var(--role-color, #3498db);
    transition: all 0.15s ease;
    overflow: hidden;
    animation: sas-btn-appear 0.9s ease-out 1.2s both;
}

@keyframes sas-btn-appear {
    0% { opacity: 0; transform: translateY(30px) scale(0.8); }
    70% { opacity: 1; transform: translateY(-5px) scale(1.05); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.sas-welcome-btn-3d:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 0 rgba(0,0,0,0.2), 0 18px 35px rgba(0,0,0,0.4), 0 0 60px var(--role-color, #3498db);
}

.sas-welcome-btn-3d:active {
    transform: translateY(4px);
    box-shadow: 0 4px 0 rgba(0,0,0,0.2), 0 6px 15px rgba(0,0,0,0.3);
}

.sas-btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    animation: sas-btn-shine-move 3s ease-in-out infinite;
}

@keyframes sas-btn-shine-move {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

.sas-btn-icon {
    font-size: 1.3em;
    animation: sas-rocket 1.5s ease-in-out infinite;
}

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

.sas-welcome-hint {
    font-size: 0.8em;
    color: #999;
    margin-top: 20px;
    animation: sas-slide-right 0.9s ease-out 1.4s both;
}

.sas-welcome-close-3d {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(0,0,0,0.08);
    border: 2px solid rgba(0,0,0,0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    font-family: inherit;
}

.sas-welcome-close-3d span {
    position: absolute;
    width: 20px;
    height: 2px;
    background: #666;
    border-radius: 2px;
    transition: all 0.3s;
}

.sas-welcome-close-3d span:nth-child(1) { transform: rotate(45deg); }
.sas-welcome-close-3d span:nth-child(2) { transform: rotate(-45deg); }

.sas-welcome-close-3d:hover {
    background: #f44336;
    border-color: #f44336;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 0 25px rgba(244,67,54,0.6);
}

.sas-welcome-close-3d:hover span { background: #fff; }

/* ============================================================
 *          TABLET (تا 992px)
 * ============================================================ */
@media (max-width: 992px) {
    .sas-stats-grid { grid-template-columns: repeat(3, 1fr); }
    .sas-welcome-name-3d { font-size: 2.2em; }
}

/* ============================================================
 *          MOBILE LARGE (تا 768px)
 * ============================================================ */
@media (max-width: 768px) {
    .sas-wrapper {
        padding: 12px;
        margin: 10px;
        border-radius: 6px;
    }

    /* ===== هدر کاربر ===== */
    .sas-user-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 20px 15px;
    }

    .sas-user-info {
        flex-direction: column;
        gap: 10px;
        align-items: center;
        width: 100%;
    }

    .sas-user-avatar {
        width: 60px;
        height: 60px;
        min-width: 60px;
        font-size: 1.7em;
    }

    .sas-user-text { text-align: center; width: 100%; }

    .sas-welcome-title {
        font-size: 1.15em !important;
        line-height: 1.4;
    }

    .sas-user-name { font-size: 1em; }
    .sas-user-role { display: block; margin: 5px 0 0 0; font-size: 0.85em; }

    .sas-header-stats {
        width: 100%;
        justify-content: center;
        gap: 8px;
    }

    .sas-mini-stat {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
        padding: 8px 10px;
    }

    .sas-mini-value { font-size: 1em; }
    .sas-mini-label { font-size: 0.75em; }

    /* ===== کارت‌های آمار ===== */
    .sas-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 15px;
    }

    .sas-stat-card { padding: 15px 10px; }
    .sas-stat-icon { font-size: 1.6em; margin-bottom: 5px; }
    .sas-stat-value { font-size: 1.6em; }
    .sas-stat-label { font-size: 0.8em; }

    /* ===== تب‌ها ===== */
    .sas-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding-bottom: 3px;
        border-bottom-width: 2px;
    }

    .sas-tabs::-webkit-scrollbar { height: 4px; }
    .sas-tabs::-webkit-scrollbar-thumb { background: #0073aa; border-radius: 2px; }
    .sas-tabs::-webkit-scrollbar-track { background: #e0e0e0; }

    .sas-tab {
        padding: 10px 15px;
        font-size: 0.85em;
        flex: 0 0 auto;
    }

    /* ===== محتوای تب ===== */
    .sas-tab-content {
        padding: 15px 12px;
        border-radius: 0 0 6px 6px;
    }

    .sas-tab-content.active {
        animation: sas-book-drop-mobile 0.5s ease-out;
    }

    @keyframes sas-book-drop-mobile {
        0% { opacity: 0; transform: translateY(-30px); }
        100% { opacity: 1; transform: translateY(0); }
    }

    /* ===== فیلترها ===== */
    .sas-filters-panel { padding: 12px; margin-bottom: 15px; }

    .sas-form-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .sas-form-row label {
        font-size: 0.85em;
        margin-bottom: -3px;
    }

    .sas-form-row select,
    .sas-form-row input[type="text"],
    .sas-form-row input[type="email"],
    .sas-form-row input[type="password"],
    .sas-form-row input[type="number"],
    .sas-form-row input[type="time"] {
        width: 100%;
        min-width: 0;
        padding: 10px 12px;
        font-size: 0.95em;
    }

    .sas-form-row button {
        width: 100%;
        padding: 12px;
        font-size: 1em;
    }

    /* ===== جدول‌ها — کارتی ===== */
    .sas-attendance-table,
    .sas-admin-table,
    .sas-report-table {
        display: block;
        font-size: 0.85em;
    }

    .sas-attendance-table thead,
    .sas-admin-table thead,
    .sas-report-table thead {
        display: none;
    }

    .sas-attendance-table tbody,
    .sas-admin-table tbody,
    .sas-report-table tbody {
        display: block;
    }

    .sas-attendance-table tr,
    .sas-admin-table tr,
    .sas-report-table tr {
        display: block;
        background: #fff;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        margin-bottom: 12px;
        padding: 12px;
        box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    }

    .sas-attendance-table td,
    .sas-admin-table td,
    .sas-report-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid #f0f0f0;
        text-align: left;
    }

    .sas-attendance-table td:last-child,
    .sas-admin-table td:last-child,
    .sas-report-table td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    .sas-attendance-table td::before,
    .sas-admin-table td::before,
    .sas-report-table td::before {
        content: attr(data-label);
        font-weight: bold;
        color: #0073aa;
        margin-left: 10px;
        flex-shrink: 0;
    }

    /* ===== رادیو ===== */
    .sas-status-cell {
        flex-direction: row;
        gap: 8px;
        width: 100%;
        justify-content: flex-end;
    }

    .sas-radio {
        padding: 8px 12px;
        font-size: 0.85em;
        flex: 1;
        justify-content: center;
    }

    /* ===== دکمه‌ها ===== */
    .sas-actions-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }

    .sas-actions-bar button {
        width: 100%;
        padding: 12px;
        font-size: 1em;
    }

    .sas-panel-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .sas-panel-header h2 { font-size: 1.1em; }
    .sas-panel-header button { width: 100%; padding: 10px; }

    /* ===== باکس‌ها ===== */
    .sas-box {
        padding: 10px;
        overflow-x: auto;
    }

    /* ===== Modal ===== */
    .sas-modal {
        padding: 20px 15px;
        max-width: 100%;
        border-radius: 12px;
    }

    .sas-modal h3 { font-size: 1.1em; }

    .sas-modal input,
    .sas-modal select {
        padding: 10px 12px;
        font-size: 1em;
    }

    .sas-modal-actions {
        flex-direction: column-reverse;
        gap: 8px;
    }

    .sas-modal-actions button {
        width: 100%;
        padding: 12px;
    }

    /* ===== Popup ===== */
    .sas-welcome-book {
        flex-direction: column;
        max-width: 100%;
        max-height: 92vh;
        border-radius: 18px;
    }

    .sas-welcome-scene {
        flex: 0 0 200px;
        min-height: 200px;
    }

    .sas-3d-card {
        width: 120px;
        height: 160px;
    }

    .sas-3d-front,
    .sas-3d-back { transform: translateZ(60px); }
    .sas-3d-right,
    .sas-3d-left { transform: rotateY(90deg) translateZ(60px); }
    .sas-3d-top,
    .sas-3d-bottom { height: 120px; transform: rotateX(90deg) translateZ(80px); }

    .sas-role-icon-big { font-size: 3.5em; }

    .sas-welcome-content {
        padding: 25px 20px;
        align-items: center;
        text-align: center;
    }

    .sas-welcome-badge { font-size: 0.8em; padding: 6px 14px; }
    .sas-welcome-name-3d { font-size: 1.6em; }
    .sas-welcome-role-3d { font-size: 0.9em; padding: 8px 18px; }
    .sas-welcome-msg { font-size: 0.95em; margin-bottom: 20px; }

    .sas-welcome-btn-3d {
        padding: 14px 30px;
        font-size: 1em;
        width: 100%;
        justify-content: center;
    }

    .sas-welcome-hint { font-size: 0.75em; }

    .sas-welcome-close-3d {
        top: 12px;
        left: 12px;
        width: 38px;
        height: 38px;
    }
}

/* ============================================================
 *          MOBILE SMALL (تا 480px)
 * ============================================================ */
@media (max-width: 480px) {
    .sas-wrapper { padding: 10px; margin: 5px; }

    .sas-user-header { padding: 15px 12px; }
    .sas-user-avatar { width: 55px; height: 55px; min-width: 55px; font-size: 1.5em; }
    .sas-welcome-title { font-size: 1em !important; }
    .sas-user-name { font-size: 0.9em; }

    .sas-stats-grid { grid-template-columns: 1fr; gap: 8px; }
    .sas-stat-card { padding: 12px 10px; }
    .sas-stat-value { font-size: 1.4em; }
    .sas-stat-icon { font-size: 1.4em; }

    .sas-tab { padding: 8px 12px; font-size: 0.8em; }
    .sas-tab-content { padding: 12px 10px; }

    .sas-welcome-scene { flex: 0 0 160px; min-height: 160px; }
    .sas-3d-card { width: 100px; height: 130px; }
    .sas-3d-front,
    .sas-3d-back { transform: translateZ(50px); }
    .sas-3d-right,
    .sas-3d-left { transform: rotateY(90deg) translateZ(50px); }
    .sas-3d-top,
    .sas-3d-bottom { height: 100px; transform: rotateX(90deg) translateZ(65px); }
    .sas-role-icon-big { font-size: 2.5em; }

    .sas-welcome-name-3d { font-size: 1.3em; }
    .sas-welcome-role-3d { font-size: 0.85em; padding: 6px 14px; margin-bottom: 15px; }
    .sas-welcome-content { padding: 20px 15px; }
    .sas-welcome-btn-3d { padding: 12px 25px; font-size: 0.95em; }
}