/* 
    Sepanta Admin Panel Styles
    Inspired by the main portfolio design
*/

:root {
    --primary_color: #d2145a;
    --dark: #212529;
    --dark-secondary: #2a2e33;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --text-primary: #ffffff;
    --text-secondary: #9f9f9f;
    --text-muted: #BCBCBC;
    --border-color: rgba(255, 255, 255, 0.1);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    scroll-behavior: smooth;
    color: var(--text-secondary);
    background: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

img {
    max-width: 100%;
}

a {
    text-decoration: none;
    color: inherit;
}

ul, ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ==================== Preloader ==================== */
.preloader {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: var(--dark);
    transform-origin: bottom;
    z-index: 111111;
}

.preloader .black_wall {
    height: 100%;
    background-color: #222;
    transform-origin: top;
    animation: preloader_slide 0.5s ease-in-out 0s 1 normal both;
}

.preloader .loader {
    width: 100%;
    height: 3px;
    position: absolute;
    border-radius: 2px;
    top: 0;
    right: 0;
    left: 0;
    margin: auto;
    background-color: var(--primary_color);
    transform-origin: left;
    animation: loader_running 3s ease-in-out 1s infinite normal both;
}

.preloader.off {
    animation: preloader_slide 0.5s ease-in-out 0s 1 reverse both;
}

/* ==================== Loading Spinner ==================== */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    min-height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary_color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner .spinner-text {
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 14px;
    opacity: 0.7;
}

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

/* Small spinner for inline use */
.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

/* ==================== Shadow Box ==================== */
.shadow-box {
    position: relative;
    border-radius: 30px;
    background: var(--dark);
}

.shadow-box::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(120deg, rgb(255 255 255 / 12%), rgb(255 255 255 / 1%));
    z-index: -1;
    border-radius: 30px;
    margin: -1px;
}

.shadow-box::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: linear-gradient(120deg, rgba(255,255,255,0.3), rgba(255,255,255,0.05));
    border-radius: 30px;
    opacity: 0.25;
    pointer-events: none;
}

.shadow-box > * {
    position: relative;
    z-index: 2;
}

.bg-img {
    display: none !important;
    opacity: 0 !important;
    position: absolute !important;
    left: 0;
    top: 0;
    border-radius: 30px;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0 !important;
    pointer-events: none;
}

/* ==================== Theme Button ==================== */
.theme-btn {
    background: var(--dark);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 500;
    padding: 14px 30px;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.theme-btn:hover {
    background: #fff;
    color: var(--dark);
}

.theme-btn.primary {
    background: var(--primary_color);
}

.theme-btn.primary:hover {
    background: #fff;
    color: var(--primary_color);
}

/* ==================== Login Page ==================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--dark);
    overflow-y: auto;
}

.login-main {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 60px;
    position: relative;
}

.login-box {
    width: 100%;
    max-width: 480px;
    padding: 50px 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header .logo {
    display: inline-block;
    margin-bottom: 30px;
}

.login-header .logo img {
    height: 28px;
}

.login-header h1 {
    font-size: 32px;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 10px;
}

.login-header p {
    color: var(--text-muted);
    opacity: 0.7;
}

/* Login Form */
.login-form .form-group {
    margin-bottom: 24px;
}

.login-form label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.login-form label i {
    font-size: 16px;
    color: var(--primary_color);
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 16px 20px;
    font-size: 15px;
    color: #fff;
    transition: all 0.3s ease;
    font-family: inherit;
    outline: none;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    border-color: var(--primary_color);
    background: rgba(210, 20, 90, 0.05);
    box-shadow: 0 0 0 3px rgba(210, 20, 90, 0.1);
}

.login-form input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 50px;
}

.toggle-password,
.toggle-password-confirm {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s ease;
    z-index: 5;
}

.toggle-password:hover,
.toggle-password-confirm:hover {
    color: var(--primary_color);
}

.toggle-password i,
.toggle-password-confirm i {
    font-size: 20px;
}

/* Error Message */
.error-message {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    margin-bottom: 24px;
    color: var(--danger);
    font-size: 14px;
    animation: shake 0.5s ease-in-out;
}

.error-message.show {
    display: flex;
}

.error-message i {
    font-size: 20px;
    flex-shrink: 0;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Success Message */
.success-message {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 12px;
    margin-bottom: 24px;
    color: var(--success);
    font-size: 14px;
    animation: slideIn 0.3s ease-out;
}

.success-message.show {
    display: flex;
}

.success-message i {
    font-size: 20px;
    flex-shrink: 0;
}

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

/* Form Hint */
.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0.6;
}

/* Link Primary */
.link-primary {
    color: var(--primary_color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.link-primary:hover {
    color: #fff;
    text-decoration: underline;
}

.login-footer p {
    color: var(--text-muted);
    font-size: 14px;
    text-transform: none;
    letter-spacing: normal;
    margin-bottom: 15px;
    opacity: 1;
}

/* Login Button */
.login-btn {
    width: 100%;
    background: var(--primary_color);
    padding: 16px 30px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 10px;
}

.login-btn:hover {
    background: #fff;
    color: var(--primary_color);
}

.login-btn i {
    transition: transform 0.3s ease;
}

.login-btn:hover i {
    transform: translateX(5px);
}

/* Login Footer */
.login-footer {
    margin-top: 40px;
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    color: var(--text-muted);
    opacity: 0.5;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.security-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(120deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    border-radius: 30px;
    color: var(--success);
    font-size: 13px;
}

.security-badge i {
    font-size: 18px;
}

/* Floating Cards */
.login-decoration {
    position: relative;
    width: 300px;
    height: 400px;
    display: none;
}

.floating-card {
    position: absolute;
    padding: 20px 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    animation: float 3s ease-in-out infinite;
}

.floating-card i {
    font-size: 24px;
    color: var(--primary_color);
}

.floating-card.card-1 {
    top: 0;
    left: 0;
    animation-delay: 0s;
}

.floating-card.card-2 {
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    animation-delay: 0.5s;
}

.floating-card.card-3 {
    bottom: 0;
    left: 20px;
    animation-delay: 1s;
}

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

.floating-card.card-2 {
    animation: float2 3s ease-in-out infinite;
    animation-delay: 0.5s;
}

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

/* ==================== Dashboard Layout ==================== */
.dashboard-page {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--dark);
    border-right: 1px solid var(--border-color);
    padding: 30px 20px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
    padding: 0 10px;
}

.sidebar-header .logo img {
    height: 24px;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.sidebar-nav {
    margin-bottom: 40px;
    flex: 1;
}

.nav-section {
    margin-bottom: 30px;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    opacity: 0.5;
    padding: 0 15px;
    margin-bottom: 15px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 15px;
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-bottom: 5px;
}

.nav-item:hover {
    background: linear-gradient(120deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary_color);
    color: var(--text-primary);
}

.nav-item i {
    font-size: 20px;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--primary_color);
    color: #fff;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 10px;
}

.nav-item.active .badge {
    background: rgba(255,255,255,0.2);
}

/* Sidebar User */
.sidebar-user {
    padding: 20px 15px;
    background: linear-gradient(120deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    border-radius: 16px;
    margin-top: auto;
}

.sidebar-user .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.sidebar-user .avatar {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    object-fit: cover;
}

.sidebar-user .user-details h4 {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 3px;
}

.sidebar-user .user-details span {
    color: var(--text-muted);
    font-size: 12px;
    opacity: 0.7;
}

.logout-btn {
    width: 100%;
    padding: 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
    color: var(--danger);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.logout-btn:hover {
    background: var(--danger);
    color: #fff;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 30px;
    min-height: 100vh;
}

/* Top Bar */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
}

.page-title h1 {
    font-size: 28px;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 5px;
}

.page-title p {
    color: var(--text-muted);
    opacity: 0.7;
    font-size: 14px;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.date-display {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: linear-gradient(120deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
}

.date-display i {
    color: var(--primary_color);
    font-size: 18px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 30px;
}

.stat-card {
    padding: 28px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card .stat-icon {
    width: 55px;
    height: 55px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 24px;
}

.stat-card .stat-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-card .stat-icon.blue {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.stat-card .stat-icon.yellow {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-card .stat-icon.pink {
    background: rgba(210, 20, 90, 0.1);
    color: var(--primary_color);
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 14px;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .stat-change {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 12px;
    font-size: 13px;
}

.stat-card .stat-change.positive {
    color: var(--success);
}

.stat-card .stat-change.negative {
    color: var(--danger);
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
}

/* Card Styles */
.card {
    padding: 24px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(135deg, rgba(210, 20, 90, 0.08) 0%, rgba(210, 20, 90, 0.02) 50%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

.card > * {
    position: relative;
    z-index: 1;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.card-header h2 {
    font-size: 18px;
    color: var(--text-primary);
    font-weight: 600;
}

.card-header .actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(120deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.icon-btn:hover {
    background: var(--primary_color);
    color: #fff;
    border-color: var(--primary_color);
}

/* Month Selector */
.month-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 20px;
    background: linear-gradient(120deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    border-radius: 12px;
}

.month-selector button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s ease;
}

.month-selector button:hover {
    color: var(--primary_color);
}

.month-selector span {
    color: var(--text-primary);
    font-weight: 600;
    min-width: 120px;
    text-align: center;
}

.date-selector-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 140px;
}

.shamsi-date-small {
    font-size: 11px !important;
    color: var(--text-muted) !important;
    font-weight: 400 !important;
    direction: rtl;
}

.today-badge {
    font-size: 10px;
    padding: 2px 8px;
    background: var(--primary_color);
    color: #fff;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Date Toggle Button */
.date-toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(120deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 12px;
}

.date-toggle-btn:hover {
    background: var(--primary_color);
    color: #fff;
    border-color: var(--primary_color);
}

.shamsi-date,
.shamsi-date-small,
[dir="rtl"] {
    font-size: 12px;
    color: var(--text-muted);
    direction: rtl;
    font-family: 'Vazirmatn', sans-serif;
}

.shamsi-date-box {
    background: linear-gradient(120deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 14px;
    margin-left: 12px;
}

.date-display {
    display: flex;
    align-items: center;
}

/* Routine Table */
.routine-table-wrapper {
    overflow-x: auto;
    margin: 0;
    padding: 0;
}

.routine-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

.routine-table th,
.routine-table td {
    padding: 14px 16px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.routine-table th {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(120deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
}

.routine-table th:first-child,
.routine-table td:first-child {
    text-align: left;
    padding-left: 20px;
}

.routine-table th:last-child,
.routine-table td:last-child {
    padding-right: 20px;
}

.routine-table tbody tr {
    transition: background 0.3s ease;
}

.routine-table tbody tr:hover {
    background: linear-gradient(120deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
}

.task-name {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-weight: 500;
}

.task-name .task-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* Checkbox Styles */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background: rgba(0, 0, 0, 0.15);
}

.task-checkbox:hover {
    border-color: rgba(210, 20, 90, 0.5);
    background: rgba(210, 20, 90, 0.08);
}

.task-checkbox.checked {
    border-color: transparent !important;
}

.task-checkbox.checked i {
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.task-checkbox i {
    display: none;
    color: rgba(255, 255, 255, 0.3);
}

.task-checkbox.checked i {
    display: block;
}

/* Task Actions */
.task-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.routine-table tbody tr:hover .task-actions {
    opacity: 1;
}

.task-action-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.task-action-btn:hover {
    background: var(--primary_color);
    color: #fff;
}

.task-action-btn.delete:hover {
    background: var(--danger);
}

/* Tooltip Styles */
.task-action-btn,
.icon-btn,
.nav-btn,
.month-selector button {
    position: relative;
}

.task-action-btn::after,
.icon-btn::after,
.nav-btn::after,
.month-selector button::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: #1a1a1a;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.task-action-btn::before,
.icon-btn::before,
.nav-btn::before,
.month-selector button::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1a1a1a;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 100;
}

.task-action-btn:hover::after,
.task-action-btn:hover::before,
.icon-btn:hover::after,
.icon-btn:hover::before,
.nav-btn:hover::after,
.nav-btn:hover::before,
.month-selector button:hover::after,
.month-selector button:hover::before {
    opacity: 1;
    visibility: visible;
}

.task-action-btn[title=""]::after,
.task-action-btn[title=""]::before,
.icon-btn[title=""]::after,
.icon-btn[title=""]::before,
.nav-btn[title=""]::after,
.nav-btn[title=""]::before,
.month-selector button[title=""]::after,
.month-selector button[title=""]::before,
.task-action-btn:not([title])::after,
.task-action-btn:not([title])::before,
.icon-btn:not([title])::after,
.icon-btn:not([title])::before,
.nav-btn:not([title])::after,
.nav-btn:not([title])::before,
.month-selector button:not([title])::after,
.month-selector button:not([title])::before {
    display: none;
}

/* Add Task Button */
.add-task-row {
    padding: 20px;
    text-align: center;
}

.add-task-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(120deg, rgba(210, 20, 90, 0.1), rgba(210, 20, 90, 0.05));
    border: 1px dashed var(--primary_color);
    border-radius: 12px;
    color: var(--primary_color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.add-task-btn:hover {
    background: var(--primary_color);
    color: #fff;
    border-style: solid;
}

/* Chart Card */
.chart-container {
    height: 300px;
    margin-top: 20px;
}

/* Progress Circle */
.progress-circle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 0;
}

.progress-circle {
    position: relative;
    width: 180px;
    height: 180px;
}

.progress-circle svg {
    transform: rotate(-90deg);
}

.progress-circle .bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 12;
}

.progress-circle .progress {
    fill: none;
    stroke: var(--primary_color);
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 502;
    stroke-dashoffset: 502;
    transition: stroke-dashoffset 1s ease;
}

.progress-circle .value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.progress-circle .value .percentage {
    font-size: 42px;
    font-weight: 700;
    color: var(--text-primary);
}

.progress-circle .value .label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Quick Stats */
.quick-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 24px;
}

.quick-stat {
    padding: 20px;
    background: linear-gradient(120deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
    border-radius: 14px;
    text-align: center;
}

.quick-stat .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.quick-stat .label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Streak Card */
.streak-card {
    padding: 24px;
    text-align: center;
}

.streak-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.streak-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.streak-label {
    color: var(--text-muted);
    font-size: 14px;
}

.streak-days {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.streak-day {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--text-muted);
}

.streak-day.completed {
    background: var(--success);
    color: #fff;
}

.streak-day.today {
    border: 2px solid var(--primary_color);
}

/* Modal Styles - Beautiful Design */
.modal-overlay,
div.modal-overlay,
#taskModal,
#deleteModal,
#resetModal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.92) !important;
    display: none !important;
    align-items: flex-start !important;
    justify-content: center !important;
    z-index: 999999 !important;
    backdrop-filter: blur(8px);
    padding: 80px 20px 40px 20px !important;
    margin: 0 !important;
    overflow-y: auto !important;
}

.modal-overlay.active,
div.modal-overlay.active,
#taskModal.active,
#deleteModal.active,
#resetModal.active {
    display: flex !important;
}

.modal-overlay .modal,
.modal-overlay.active .modal,
div.modal-overlay .modal,
#taskModal .modal,
#deleteModal .modal,
#resetModal .modal {
    width: 100% !important;
    max-width: 500px !important;
    padding: 0 !important;
    margin: 0 auto !important;
    background: linear-gradient(135deg, #2a2e33 0%, #212529 100%) !important;
    border-radius: 20px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(210, 20, 90, 0.2) !important;
    position: relative !important;
    overflow: hidden !important;
    display: block !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
    height: auto !important;
    max-height: calc(100vh - 160px) !important;
}

/* Hide shadow-box effects on modal */
.modal.shadow-box::before,
.modal.shadow-box::after,
.modal-overlay .modal.shadow-box::before,
.modal-overlay .modal.shadow-box::after {
    content: none !important;
    display: none !important;
}

.modal .bg-img,
.modal-overlay .modal .bg-img {
    display: none !important;
    opacity: 0 !important;
}

.modal-header,
.modal-overlay .modal-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 28px 30px !important;
    margin: 0 !important;
    position: relative !important;
    z-index: 5 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
    background: linear-gradient(135deg, rgba(210, 20, 90, 0.05) 0%, transparent 100%) !important;
}

.modal-header h2,
.modal-overlay .modal-header h2 {
    font-size: 22px !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    margin: 0 !important;
    letter-spacing: -0.3px !important;
}

.modal-close,
.modal-overlay .modal-close {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    color: var(--text-muted) !important;
    font-size: 20px !important;
}

.modal-close:hover,
.modal-overlay .modal-close:hover {
    background: rgba(210, 20, 90, 0.15) !important;
    border-color: var(--primary_color) !important;
    color: var(--primary_color) !important;
}

.modal-body,
.modal-overlay .modal-body {
    padding: 30px !important;
    position: relative !important;
    z-index: 5 !important;
    display: block !important;
}

.modal-footer,
.modal-overlay .modal-footer {
    padding: 20px 30px 30px 30px !important;
    position: relative !important;
    z-index: 5 !important;
    display: flex !important;
    gap: 12px !important;
    margin: 0 !important;
}

.modal-close {
    /* Styles handled above with !important */
}

.modal-body .form-group {
    margin-bottom: 22px !important;
}

.modal-body .form-group:last-child {
    margin-bottom: 0 !important;
}

.modal-body label {
    display: block !important;
    font-size: 11px !important;
    color: rgba(255, 255, 255, 0.6) !important;
    margin-bottom: 10px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.8px !important;
    font-weight: 600 !important;
}

.modal-body input,
.modal-body select {
    width: 100% !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border-radius: 12px !important;
    padding: 14px 16px !important;
    font-size: 15px !important;
    color: #fff !important;
    transition: all 0.2s ease !important;
    font-family: inherit !important;
    outline: none !important;
}

.modal-body input:focus,
.modal-body select:focus {
    border-color: var(--primary_color) !important;
    background: rgba(210, 20, 90, 0.08) !important;
    box-shadow: 0 0 0 3px rgba(210, 20, 90, 0.1) !important;
}

.modal-body select {
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px !important;
    padding-right: 40px !important;
}

.modal-body select option {
    background: var(--dark) !important;
    color: #fff !important;
}

.modal-footer {
    /* Styles handled above with !important */
}

.modal-footer .theme-btn {
    flex: 1 !important;
    padding: 14px 24px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.8) !important;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
}

.modal-footer .theme-btn.primary {
    background: linear-gradient(135deg, var(--primary_color) 0%, #b01048 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(210, 20, 90, 0.3) !important;
}

.modal-footer .theme-btn.primary:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(210, 20, 90, 0.4) !important;
}

/* Time Period Tabs */
.period-tabs {
    display: flex;
    gap: 10px;
}

.period-tab {
    padding: 10px 20px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.period-tab:hover {
    border-color: var(--primary_color);
    color: var(--primary_color);
}

.period-tab.active {
    background: var(--primary_color);
    border-color: var(--primary_color);
    color: #fff;
}

/* ==================== Animations ==================== */
@keyframes loader_running {
    0% {
        transform: scaleX(0);
        transform-origin: left;
    }
    49% {
        transform: scaleX(1);
        transform-origin: left;
    }
    50% {
        transform: scaleX(1);
        transform-origin: right;
    }
    100% {
        transform-origin: right;
        transform: scaleX(0);
    }
}

@keyframes preloader_slide {
    from {
        transform: scaleY(0);
    }
    to {
        transform: scaleY(1);
    }
}

/* ==================== Responsive ==================== */
@media (min-width: 1200px) {
    .login-decoration {
        display: block;
    }
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-close {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .top-bar-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .login-box {
        padding: 40px 25px;
    }
    
    .login-header h1 {
        font-size: 26px;
    }
    
    .quick-stats {
        grid-template-columns: 1fr;
    }
    
    .period-tabs {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 20px 15px;
    }
    
    .card {
        padding: 20px 15px;
    }
    
    .month-selector {
        padding: 8px 15px;
    }
    
    .month-selector span {
        min-width: 100px;
        font-size: 14px;
    }
}

/* ==================== Reload Banner ==================== */
.reload-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.05));
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    margin-bottom: 24px;
    gap: 20px;
}

.reload-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--info);
    font-size: 14px;
}

.reload-banner-content i {
    font-size: 20px;
}

.reload-banner-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--info);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.reload-banner-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

/* ==================== Category Grouped Tasks ==================== */
.category-header-row {
    background: transparent !important;
}

.category-header-row td {
    border-bottom: 1px solid var(--border-color);
    padding-top: 20px !important;
}

.category-header-row td:first-child {
    padding-left: 20px !important;
}

.category-header-row:first-child td {
    padding-top: 0 !important;
}

.category-label {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Add indentation for routine rows under categories */
.routine-table tbody tr:not(.category-header-row) td:first-child {
    padding-left: 48px !important;
}

.task-name {
    display: flex;
    align-items: center;
    gap: 12px;
}

.task-checkbox.checked {
    background: var(--primary);
    border-color: var(--primary);
}

.routine-table tr:hover {
    background: var(--bg-hover);
}

.routine-table tr.category-header-row:hover {
    background: transparent;
}

/* ==================== RESPONSIVE DESIGN ==================== */

/* Tablet and below (max-width: 1024px) */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .sidebar {
        width: 280px;
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    
    .settings-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
}

/* Mobile landscape and below (max-width: 768px) */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 16px;
    }
    
    .top-bar-left,
    .top-bar-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .page-title h1 {
        font-size: 20px;
    }
    
    .page-title p {
        font-size: 12px;
    }
    
    .card {
        padding: 20px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .month-selector {
        flex: 1;
    }
    
    .routine-table {
        font-size: 13px;
    }
    
    .routine-table th,
    .routine-table td {
        padding: 10px 8px;
    }
    
    .task-name {
        font-size: 13px;
    }
    
    .task-checkbox {
        width: 20px;
        height: 20px;
    }
    
    .modal-overlay {
        padding: 20px 16px !important;
    }
    
    .modal {
        max-width: 100% !important;
        border-radius: 16px !important;
    }
    
    .modal-header {
        padding: 20px !important;
    }
    
    .modal-body {
        padding: 20px !important;
    }
    
    .modal-footer {
        padding: 16px 20px 20px 20px !important;
        flex-direction: column;
    }
    
    .modal-footer .theme-btn {
        width: 100%;
    }
    
    .settings-card {
        padding: 20px !important;
    }
    
    .settings-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 12px !important;
    }
    
    .setting-item {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }
    
    .setting-item .theme-btn {
        width: 100%;
    }
    
    .routines-list .routine-item {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }
    
    .shamsi-date-box {
        margin-left: 0;
        margin-top: 8px;
    }
}

/* Mobile portrait (max-width: 480px) */
@media (max-width: 480px) {
    .sidebar {
        width: 260px;
    }
    
    .main-content {
        padding: 12px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .card {
        padding: 16px;
    }
    
    .card-header h2 {
        font-size: 16px;
    }
    
    .period-tabs {
        width: 100%;
        justify-content: space-between;
    }
    
    .period-tab {
        flex: 1;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .top-routines {
        gap: 8px;
    }
    
    .top-routine-item {
        padding: 12px;
    }
    
    .modal-header h2 {
        font-size: 18px !important;
    }
    
    .modal-body label {
        font-size: 10px !important;
    }
    
    .modal-body input,
    .modal-body select {
        font-size: 14px !important;
        padding: 12px !important;
    }
}

/* Settings page specific responsive */
@media (max-width: 1200px) {
    .settings-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Fix date display on mobile */
@media (max-width: 640px) {
    .date-display {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .date-selector-content {
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }
    
    .shamsi-date-small {
        font-size: 10px !important;
    }
}

/* ============================================
   BOTTOM POPOVER FOR SAVE/DISCARD
============================================ */
.save-discard-popover {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    transition: bottom 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
}

.save-discard-popover.show {
    bottom: 30px;
    pointer-events: all;
}

.popover-content {
    background: linear-gradient(120deg, rgba(210, 20, 90, 0.15), rgba(26, 29, 33, 0.98));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(210, 20, 90, 0.3);
    border-radius: 20px;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 
                0 0 20px rgba(210, 20, 90, 0.2);
    min-width: 400px;
}

.popover-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.popover-info i {
    font-size: 20px;
    color: var(--primary_color);
}

.popover-actions {
    display: flex;
    gap: 12px;
}

.popover-actions button {
    padding: 10px 20px;
    border-radius: 12px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
}

.popover-actions button i {
    font-size: 18px;
}

.btn-discard {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

.btn-discard:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.btn-save {
    background: linear-gradient(135deg, var(--primary_color), #a01048);
    color: white;
    box-shadow: 0 4px 15px rgba(210, 20, 90, 0.3);
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(210, 20, 90, 0.5);
}

.btn-save:disabled,
.btn-discard:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Mobile responsive */
@media (max-width: 640px) {
    .popover-content {
        min-width: auto;
        width: calc(100vw - 40px);
        flex-direction: column;
        gap: 16px;
        padding: 16px 20px;
    }
    
    .popover-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .popover-actions button {
        flex: 1;
        justify-content: center;
    }
    
    .save-discard-popover.show {
        bottom: 20px;
    }
}


