:root {
    --bg-color: #0b1220;
    --sidebar-bg: #111b33;
    --content-bg: #0f1729;
    --card-bg: #16213e;
    --text-color: #67e8f9;
    --text-light: #d5def0;
    --primary-color: #3b82f6;
    --border-color: rgba(103, 232, 249, 0.25);
    --danger-color: #ef4444;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 18px 45px rgba(0, 0, 0, 0.35);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

@font-face {
    font-family: 'Vazir';
    src: url('../fonts/Vazir.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazir';
    src: url('../fonts/Vazir-Bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazir';
    src: url('../fonts/Vazir-Light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazir';
    src: url('../fonts/Vazir-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Vazir', Tahoma, sans-serif;
    margin: 0;
    background: linear-gradient(180deg, #07101f 0%, #0b1220 100%);
    background-attachment: fixed;
    color: var(--text-light);
    direction: rtl;
    overflow-x: hidden;
}

a {
    color: inherit;
    transition: color var(--transition-fast);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--sidebar-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5b9cf6;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

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

.main-container {
    display: flex;
    min-height: 100vh;
    animation: fadeIn 0.5s ease;
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, rgba(17, 27, 51, 0.95) 100%);
    backdrop-filter: blur(10px);
    padding: 24px 18px;
    height: 100vh;
    position: fixed;
    top: 0;
    right: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    border-left: 1px solid var(--border-color);
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.15), inset 0 0 60px rgba(59, 130, 246, 0.03);
    animation: slideInRight var(--transition-slow);
    z-index: 100;
}

.sidebar h2 {
    color: var(--text-color);
    text-align: center;
    margin-top: 0;
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 0 0 20px rgba(103, 232, 249, 0.5);
    margin-bottom: 30px;
    animation: float 3s ease-in-out infinite;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 24px 0 0;
    padding-bottom: 24px;
}

.sidebar ul li a {
    color: var(--text-light);
    text-decoration: none;
    display: block;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.sidebar ul li a::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.3), transparent);
    transition: width var(--transition-normal);
}

.sidebar ul li a:hover {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.1));
    transform: translateX(-4px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.sidebar ul li a:hover::before {
    width: 100%;
}

.content {
    flex-grow: 1;
    margin-right: 280px;
    padding: 32px 28px;
    animation: fadeIn 0.6s ease;
}

h1 {
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-top: 0;
    font-size: 2rem;
    font-weight: bold;
    text-shadow: 0 2px 10px rgba(103, 232, 249, 0.3);
    animation: slideInLeft 0.5s ease;
}

.card,
.stat-card,
.login-box {
    background: linear-gradient(135deg, rgba(17, 27, 51, 0.95) 0%, rgba(22, 33, 62, 0.9) 100%);
    backdrop-filter: blur(12px);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all var(--transition-normal);
    animation: fadeIn 0.5s ease backwards;
    position: relative;
    overflow: hidden;
}

.card::before,
.stat-card::before,
.login-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.03), transparent);
    transition: left 0.5s ease;
}

.card:hover::before,
.stat-card:hover::before {
    left: 100%;
}

.card:hover,
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3), 0 0 30px rgba(59, 130, 246, 0.1);
    border-color: rgba(103, 232, 249, 0.4);
}

.card h2,
.stat-card h3 {
    margin-top: 0;
    color: var(--text-color);
    font-weight: 600;
}

.stat-card {
    animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.3s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.4s;
}

.stats-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border: 2px solid var(--border-color);
    background: linear-gradient(135deg, rgba(7, 16, 31, 0.95) 0%, rgba(11, 18, 32, 0.9) 100%);
    color: var(--text-light);
    border-radius: 10px;
    font-size: 14px;
    transition: all var(--transition-normal);
    font-family: 'Vazir', Tahoma, sans-serif;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 4px 12px rgba(59, 130, 246, 0.2);
    transform: translateY(-1px);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2367e8f9' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 35px;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, #2563eb 100%);
    color: #fff;
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    text-decoration: none;
    transition: all var(--transition-normal);
    font-family: 'Vazir', Tahoma, sans-serif;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    position: relative;
    overflow: hidden;
}

button::before,
.button-link::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:hover,
.button-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

button:hover::before,
.button-link:hover::before {
    width: 300px;
    height: 300px;
}

button:active,
.button-link:active {
    transform: translateY(0);
}

.secondary-link {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.secondary-link:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.1) 100%);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-light);
    font-weight: 500;
    font-size: 14px;
}

table {
    width: 100%;
    border-collapse: collapse;
    animation: fadeIn 0.6s ease;
}

th,
td {
    padding: 12px;
    text-align: right;
    border-bottom: 1px solid rgba(103, 232, 249, 0.12);
    vertical-align: top;
    transition: background-color var(--transition-fast);
}

th {
    color: var(--text-color);
    font-weight: 600;
    background: rgba(59, 130, 246, 0.05);
    position: sticky;
    top: 0;
    z-index: 10;
}

tbody tr {
    transition: all var(--transition-fast);
}

tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
    transform: scale(1.01);
}

.flash-messages {
    margin-bottom: 15px;
    animation: slideInLeft 0.5s ease;
}

.alert {
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 10px;
    animation: slideInLeft 0.5s ease;
    border-left: 4px solid;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(8px);
}

.alert-success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(34, 197, 94, 0.1) 100%);
    color: #d1fae5;
    border-left-color: var(--success-color);
}

.alert-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.1) 100%);
    color: #fee2e2;
    border-left-color: var(--danger-color);
}

.alert-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(245, 158, 11, 0.1) 100%);
    color: #fef3c7;
    border-left-color: var(--warning-color);
}

.alert-info {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2) 0%, rgba(6, 182, 212, 0.1) 100%);
    color: #cffafe;
    border-left-color: var(--info-color);
}

.action-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.path-cell {
    word-break: break-all;
    max-width: 260px;
}

.hint {
    color: #94a3b8;
    font-size: 13px;
    font-style: italic;
}

.top-gap {
    margin-top: 16px;
}

.code-block {
    font-family: Consolas, monospace;
    direction: ltr;
    text-align: left;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #07101f 0%, #0b1220 50%, #0f1729 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.8s ease;
}

.login-box {
    width: 100%;
    max-width: 460px;
    animation: fadeIn 1s ease;
}

.login-box h2 {
    margin-top: 0;
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 24px;
    text-shadow: 0 0 20px rgba(103, 232, 249, 0.5);
}

.login-box p {
    color: #cbd5e1;
    text-align: center;
}

.atlascraft-login-button {
    width: 100%;
    min-height: 46px;
    margin-bottom: 18px;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #94a3b8;
    margin: 4px 0 18px;
    font-size: 13px;
}

.login-divider::before,
.login-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* Loading spinner */
.spinner {
    border: 3px solid rgba(103, 232, 249, 0.1);
    border-top: 3px solid var(--text-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Icon styles */
.icon {
    margin-left: 8px;
    transition: transform var(--transition-fast);
}

button:hover .icon,
.button-link:hover .icon {
    transform: scale(1.1);
}

/* Badge styles */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #16a34a 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.badge-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.badge-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.badge-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #0891b2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

@media (max-width: 960px) {
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        min-height: auto;
        overflow: visible;
    }

    .content {
        margin-right: 0;
    }

    .main-container {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    table {
        font-size: 14px;
    }
    
    th, td {
        padding: 8px;
    }
}

/* Additional enhancements */

/* Checkbox styling */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-left: 8px;
    accent-color: var(--primary-color);
}

/* Form groups */
.form-group {
    margin-bottom: 20px;
}

/* Disabled input styling */
input:disabled,
textarea:disabled,
select:disabled {
    background: rgba(100, 116, 139, 0.1);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Table enhancements */
table {
    overflow-x: auto;
    display: block;
}

thead {
    display: table;
    width: 100%;
    table-layout: fixed;
}

tbody {
    display: table;
    width: 100%;
    table-layout: fixed;
}

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    opacity: 0.7;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
    opacity: 0.5;
}

/* Success state */
.success-message {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(34, 197, 94, 0.1) 100%);
    border: 1px solid var(--success-color);
    border-radius: 10px;
    padding: 16px;
    margin: 16px 0;
    color: #d1fae5;
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Stat card value emphasis */
.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-color);
    display: block;
    margin: 12px 0;
    text-shadow: 0 2px 10px rgba(103, 232, 249, 0.3);
}

/* Icon animations */
@keyframes iconBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.sidebar h2 i {
    display: inline-block;
    animation: iconBounce 2s ease-in-out infinite;
}

/* Hover glow effect for cards */
.card:hover,
.stat-card:hover {
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3), 0 0 40px rgba(59, 130, 246, 0.15);
}

/* Button group */
.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, var(--text-color) 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Pulse animation for important elements */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.8);
    }
}

.pulse-glow {
    animation: pulseGlow 2s ease-in-out infinite;
}

/* Tooltip arrow */
.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(17, 27, 51, 0.95);
}

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

/* Selection styling */
::selection {
    background: var(--primary-color);
    color: white;
}

::-moz-selection {
    background: var(--primary-color);
    color: white;
}

/* Print styles */
@media print {
    .sidebar,
    .action-row,
    button,
    .button-link {
        display: none !important;
    }
    
    .content {
        margin-right: 0;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support (if needed in future) */
@media (prefers-color-scheme: dark) {
    /* Already dark by default */
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --border-color: rgba(103, 232, 249, 0.5);
    }
    
    .card,
    .stat-card,
    .login-box {
        border-width: 2px;
    }
}
