/* ============================================
   TADAVI DASHBOARD - Fully Isolated CSS
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');

/* ---- CSS Variables ---- */
.tdv-dashboard,
.tdv-auth-wrap {
    --tdv-primary: #006b65;
    --tdv-primary-dark: #005550;
    --tdv-primary-light: #e6f4f3;
    --tdv-bg: #f3eee4;
    --tdv-white: #ffffff;
    --tdv-text: #1a1a1a;
    --tdv-text-muted: #888888;
    --tdv-border: #e5e0d8;
    --tdv-radius-sm: 10px;
    --tdv-radius-md: 14px;
    --tdv-radius-lg: 20px;
    --tdv-radius-xl: 24px;
    --tdv-shadow: 0 2px 16px rgba(0,107,101,0.08);
    --tdv-shadow-lg: 0 8px 40px rgba(0,107,101,0.12);
    --tdv-font: 'Vazirmatn', 'Vazir', Tahoma, Arial, sans-serif;
    --tdv-sidebar-w: 240px;
}

/* ============================================
   AUTH SCREEN
   ============================================ */

.tdv-auth-wrap {
    all: initial;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    background-color: var(--tdv-bg);
    padding: 32px 16px;
    box-sizing: border-box;
    font-family: var(--tdv-font);
    direction: rtl;
}

.tdv-auth-wrap * {
    box-sizing: border-box;
    font-family: var(--tdv-font);
    direction: rtl;
    margin: 0;
    padding: 0;
}

.tdv-auth-box {
    background: var(--tdv-white);
    border-radius: var(--tdv-radius-xl);
    padding: 40px 36px;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--tdv-shadow-lg);
}

.tdv-auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.tdv-auth-logo-text {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: var(--tdv-primary);
    line-height: 1.3;
    font-family: var(--tdv-font);
}

.tdv-auth-logo-sub {
    display: block;
    font-size: 13px;
    color: var(--tdv-text-muted);
    margin-top: 4px;
    font-family: var(--tdv-font);
    font-weight: 400;
    line-height: 1.5;
}

.tdv-auth-tabs {
    display: flex;
    background: var(--tdv-bg);
    border-radius: 16px;
    padding: 4px;
    margin-bottom: 28px;
    gap: 4px;
}

.tdv-auth-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--tdv-primary);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-family: var(--tdv-font);
    line-height: 1.5;
    user-select: none;
}

.tdv-auth-tab.tdv-active {
    background: var(--tdv-primary);
    color: var(--tdv-white);
}

.tdv-auth-form {
    display: none;
}

.tdv-auth-form.tdv-active {
    display: block;
}

.tdv-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ============================================
   SHARED FORM ELEMENTS
   ============================================ */

.tdv-auth-wrap .tdv-field-group,
.tdv-dashboard .tdv-field-group {
    margin-bottom: 16px;
}

.tdv-auth-wrap .tdv-label,
.tdv-dashboard .tdv-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 7px;
    font-family: var(--tdv-font);
    line-height: 1.5;
}

.tdv-auth-wrap .tdv-input,
.tdv-dashboard .tdv-input {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--tdv-border);
    border-radius: var(--tdv-radius-md);
    font-size: 14px;
    color: var(--tdv-text);
    background: var(--tdv-white);
    font-family: var(--tdv-font);
    direction: rtl;
    text-align: right;
    line-height: 1.5;
    outline: none;
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
}

.tdv-auth-wrap .tdv-input:focus,
.tdv-dashboard .tdv-input:focus {
    border-color: var(--tdv-primary);
    outline: none;
}

.tdv-input-disabled {
    background: var(--tdv-bg) !important;
    cursor: not-allowed;
    color: var(--tdv-text-muted) !important;
}

.tdv-ltr {
    direction: ltr !important;
    text-align: left !important;
}

.tdv-select {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--tdv-border);
    border-radius: var(--tdv-radius-md);
    font-size: 14px;
    color: var(--tdv-text);
    background: var(--tdv-white);
    font-family: var(--tdv-font);
    direction: rtl;
    text-align: right;
    line-height: 1.5;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
}

.tdv-select:focus {
    border-color: var(--tdv-primary);
    outline: none;
}

.tdv-textarea {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--tdv-border);
    border-radius: var(--tdv-radius-md);
    font-size: 14px;
    color: var(--tdv-text);
    background: var(--tdv-white);
    font-family: var(--tdv-font);
    direction: rtl;
    text-align: right;
    line-height: 1.7;
    outline: none;
    resize: vertical;
    min-height: 110px;
    transition: border-color 0.2s;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
}

.tdv-textarea:focus {
    border-color: var(--tdv-primary);
    outline: none;
}

/* BUTTONS */
.tdv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--tdv-radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    outline: none;
    font-family: var(--tdv-font);
    line-height: 1.5;
    transition: background 0.2s, color 0.2s, opacity 0.2s;
    text-decoration: none;
    user-select: none;
}

.tdv-btn-primary {
    background: var(--tdv-primary);
    color: var(--tdv-white);
}

.tdv-btn-primary:hover {
    background: var(--tdv-primary-dark);
    color: var(--tdv-white);
}

.tdv-btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.tdv-btn-full {
    width: 100%;
    margin-top: 4px;
}

/* MESSAGES */
.tdv-msg {
    display: none;
    padding: 12px 16px;
    border-radius: var(--tdv-radius-sm);
    font-size: 13px;
    font-weight: 500;
    margin-top: 12px;
    font-family: var(--tdv-font);
    line-height: 1.5;
}

.tdv-msg-success {
    background: var(--tdv-primary-light);
    color: var(--tdv-primary);
}

.tdv-msg-error {
    background: #fde8e8;
    color: #c0392b;
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */

.tdv-dashboard {
    all: initial;
    display: flex;
    min-height: 100vh;
    width: 100%;
    background-color: var(--tdv-bg);
    font-family: var(--tdv-font);
    direction: rtl;
    box-sizing: border-box;
    position: relative;
}

.tdv-dashboard * {
    box-sizing: border-box;
    font-family: var(--tdv-font);
    direction: rtl;
    margin: 0;
    padding: 0;
}

/* ============================================
   SIDEBAR
   ============================================ */

.tdv-sidebar {
    width: var(--tdv-sidebar-w);
    min-width: var(--tdv-sidebar-w);
    background: var(--tdv-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
}

.tdv-sidebar-header {
    padding: 28px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

.tdv-brand {
    display: block;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    line-height: 1.3;
    font-family: var(--tdv-font);
}

.tdv-brand-sub {
    display: block;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    margin-top: 3px;
    font-family: var(--tdv-font);
    font-weight: 400;
    line-height: 1.5;
}

.tdv-sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

.tdv-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    font-family: var(--tdv-font);
    flex-shrink: 0;
}

.tdv-user-info {
    min-width: 0;
    flex: 1;
}

.tdv-username {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--tdv-font);
}

.tdv-user-email {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--tdv-font);
    font-weight: 400;
    line-height: 1.5;
    direction: ltr;
    text-align: right;
}

.tdv-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tdv-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 14px;
    cursor: pointer;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--tdv-font);
    line-height: 1.5;
    transition: background 0.18s, color 0.18s;
    user-select: none;
    text-decoration: none;
}

.tdv-nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.tdv-nav-item.tdv-active {
    background: rgba(255,255,255,0.18);
    color: #fff;
    font-weight: 700;
}

.tdv-nav-icon {
    width: 22px;
    height: 22px;
    min-width: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tdv-nav-icon img {
    width: 22px;
    height: 22px;
    display: block;
    filter: brightness(0) invert(0.6);
    transition: filter 0.18s;
}

.tdv-nav-item:hover .tdv-nav-icon img,
.tdv-nav-item.tdv-active .tdv-nav-icon img {
    filter: brightness(0) invert(1);
}

.tdv-nav-label {
    font-size: 14px;
    font-family: var(--tdv-font);
    font-weight: inherit;
    line-height: 1.5;
    color: inherit;
}

.tdv-sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255,255,255,0.12);
}

.tdv-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 16px;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.2);
    font-family: var(--tdv-font);
    line-height: 1.5;
    transition: background 0.18s, color 0.18s;
    outline: none;
}

.tdv-logout-btn:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* ============================================
   MAIN
   ============================================ */

.tdv-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--tdv-bg);
}

.tdv-topbar {
    background: var(--tdv-white);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--tdv-border);
    box-shadow: 0 2px 8px rgba(0,107,101,0.05);
    position: sticky;
    top: 0;
    z-index: 90;
}

.tdv-topbar-title {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--tdv-text);
    line-height: 1.4;
    font-family: var(--tdv-font);
}

.tdv-topbar-sub {
    display: block;
    font-size: 13px;
    color: var(--tdv-text-muted);
    margin-top: 2px;
    font-family: var(--tdv-font);
    font-weight: 400;
    line-height: 1.5;
}

.tdv-content {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
}

/* ============================================
   TABS
   ============================================ */

.tdv-tab-panel {
    display: none;
}

.tdv-tab-panel.tdv-active {
    display: block;
}

/* ============================================
   CARDS
   ============================================ */

.tdv-card {
    background: var(--tdv-white);
    border-radius: var(--tdv-radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--tdv-shadow);
}

.tdv-card-title {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--tdv-primary);
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--tdv-bg);
    font-family: var(--tdv-font);
    line-height: 1.4;
}

.tdv-card-desc {
    display: block;
    font-size: 13px;
    color: var(--tdv-text-muted);
    margin-bottom: 18px;
    line-height: 1.7;
    font-family: var(--tdv-font);
    font-weight: 400;
}

/* ============================================
   STATS
   ============================================ */

.tdv-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.tdv-stat-box {
    background: var(--tdv-white);
    border-radius: var(--tdv-radius-lg);
    padding: 22px 16px;
    text-align: center;
    box-shadow: var(--tdv-shadow);
}

.tdv-stat-num {
    display: block;
    font-size: 30px;
    font-weight: 800;
    color: var(--tdv-primary);
    line-height: 1.2;
    margin-bottom: 6px;
    font-family: var(--tdv-font);
}

.tdv-stat-label {
    display: block;
    font-size: 13px;
    color: var(--tdv-text-muted);
    font-weight: 500;
    font-family: var(--tdv-font);
    line-height: 1.5;
}

/* ============================================
   GIFT BANNER
   ============================================ */

.tdv-gift-banner {
    background: linear-gradient(135deg, #006b65 0%, #009e95 100%);
    border-radius: var(--tdv-radius-xl);
    padding: 24px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.tdv-gift-icon-wrap {
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tdv-gift-icon-wrap img {
    width: 26px;
    height: 26px;
    display: block;
    filter: brightness(0) invert(1);
}

.tdv-gift-body {
    flex: 1;
}

.tdv-gift-title {
    display: block;
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    line-height: 1.4;
    margin-bottom: 5px;
    font-family: var(--tdv-font);
}

.tdv-gift-desc {
    display: block;
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    line-height: 1.7;
    font-family: var(--tdv-font);
    font-weight: 400;
}

/* ============================================
   TABLE
   ============================================ */

.tdv-table-wrap {
    overflow-x: auto;
    width: 100%;
}

.tdv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-family: var(--tdv-font);
}

.tdv-table th,
.tdv-table td {
    padding: 12px 14px;
    text-align: right;
    border-bottom: 1px solid #f0ece5;
    white-space: nowrap;
    font-size: 13px;
    line-height: 1.5;
    font-family: var(--tdv-font);
    font-weight: 400;
    color: var(--tdv-text);
}

.tdv-table thead th {
    background: var(--tdv-bg);
    font-weight: 700;
    color: var(--tdv-primary);
    border-bottom: 2px solid var(--tdv-border);
    font-size: 13px;
}

.tdv-table tbody tr:hover {
    background: #faf8f4;
}

.tdv-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--tdv-font);
    line-height: 1.5;
    white-space: nowrap;
}

.tdv-badge-green {
    background: var(--tdv-primary-light);
    color: var(--tdv-primary);
}

.tdv-badge-yellow {
    background: #fef9e7;
    color: #b7950b;
}

.tdv-badge-red {
    background: #fde8e8;
    color: #c0392b;
}

/* ============================================
   FORM GRID
   ============================================ */

.tdv-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 8px;
}

.tdv-col-full {
    grid-column: 1 / -1;
}

.tdv-section-label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--tdv-primary);
    margin: 20px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--tdv-bg);
    font-family: var(--tdv-font);
    line-height: 1.5;
}

.tdv-section-label:first-child {
    margin-top: 0;
}

.tdv-form-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 20px;
}

/* ============================================
   INFO GRID
   ============================================ */

.tdv-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.tdv-info-item {
    padding: 14px 16px;
    background: var(--tdv-bg);
    border-radius: var(--tdv-radius-sm);
}

.tdv-info-key {
    display: block;
    font-size: 11px;
    color: var(--tdv-text-muted);
    font-weight: 600;
    margin-bottom: 4px;
    font-family: var(--tdv-font);
    line-height: 1.5;
}

.tdv-info-val {
    display: block;
    font-size: 14px;
    color: var(--tdv-text);
    font-weight: 500;
    font-family: var(--tdv-font);
    line-height: 1.5;
}

/* ============================================
   NOTIFICATIONS
   ============================================ */

.tdv-notif-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
    background: var(--tdv-white);
    border-radius: var(--tdv-radius-lg);
    margin-bottom: 12px;
    box-shadow: var(--tdv-shadow);
    border-right: 4px solid var(--tdv-primary);
}

.tdv-notif-icon-wrap {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: var(--tdv-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tdv-notif-icon-wrap img {
    width: 20px;
    height: 20px;
    display: block;
    filter: brightness(0) saturate(100%) invert(27%) sepia(55%) saturate(700%) hue-rotate(150deg);
}

.tdv-notif-body {
    flex: 1;
    min-width: 0;
}

.tdv-notif-title {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--tdv-text);
    margin-bottom: 5px;
    font-family: var(--tdv-font);
    line-height: 1.4;
}

.tdv-notif-text {
    display: block;
    font-size: 13px;
    color: #666;
    line-height: 1.7;
    font-family: var(--tdv-font);
    font-weight: 400;
}

.tdv-notif-date {
    display: block;
    font-size: 11px;
    color: #aaa;
    margin-top: 6px;
    font-family: var(--tdv-font);
    font-weight: 400;
    line-height: 1.5;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.tdv-empty {
    text-align: center;
    padding: 48px 20px;
}

.tdv-empty-icon {
    width: 56px;
    height: 56px;
    display: block;
    margin: 0 auto 16px;
    opacity: 0.25;
    filter: grayscale(1);
}

.tdv-empty-text {
    display: block;
    font-size: 14px;
    color: #aaa;
    font-family: var(--tdv-font);
    font-weight: 400;
    line-height: 1.5;
}

/* ============================================
   MOBILE NAV
   ============================================ */

.tdv-mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    background: var(--tdv-primary);
    z-index: 999;
    padding: 8px 8px 12px;
    box-shadow: 0 -4px 20px rgba(0,107,101,0.15);
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
}

.tdv-mob-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 12px;
    cursor: pointer;
    color: rgba(255,255,255,0.6);
    font-size: 10px;
    gap: 4px;
    min-width: 50px;
    transition: background 0.18s, color 0.18s;
    user-select: none;
    font-family: var(--tdv-font);
    font-weight: 500;
    line-height: 1.3;
}

.tdv-mob-nav-item.tdv-active {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.tdv-mob-nav-item img {
    width: 22px;
    height: 22px;
    display: block;
    filter: brightness(0) invert(0.55);
    transition: filter 0.18s;
}

.tdv-mob-nav-item.tdv-active img {
    filter: brightness(0) invert(1);
}

.tdv-mob-nav-item span {
    font-size: 10px;
    color: inherit;
    font-family: var(--tdv-font);
    line-height: 1.3;
    font-weight: inherit;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 900px) {
    .tdv-sidebar {
        width: 200px;
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .tdv-sidebar {
        display: none;
    }

    .tdv-mobile-nav {
        display: flex;
    }

    .tdv-main {
        padding-bottom: 80px;
    }

    .tdv-topbar {
        padding: 14px 16px;
    }

    .tdv-content {
        padding: 16px;
    }

    .tdv-stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .tdv-form-grid {
        grid-template-columns: 1fr;
    }

    .tdv-info-grid {
        grid-template-columns: 1fr;
    }

    .tdv-auth-box {
        padding: 28px 20px;
    }

    .tdv-form-row {
        grid-template-columns: 1fr;
    }

    .tdv-gift-banner {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .tdv-stats-grid {
        grid-template-columns: 1fr;
    }

    .tdv-content {
        padding: 12px;
    }
}