/* Professional Material Design 3 Styling variables & specifications */
@font-face {
    font-family: 'Vazir';
    src: url('../fonts/Vazirmatn-Regular.ttf') format('truetype');
    font-weight: normal;
}
@font-face {
    font-family: 'Vazir';
    src: url('../fonts/Vazirmatn-Bold.ttf') format('truetype');
    font-weight: bold;
}

:root {
    --bg-color: #f8f9fa; /* Material Light surface container lowest */
    --surface-color: #ffffff; /* Material Light surface */
    --surface-variant: #f1f3f4; /* Material Light surface variant */
    --primary-color: #1a73e8; /* Material Primary Blue */
    --primary-hover: #1557b0;
    --on-primary: #ffffff;
    --secondary-color: #1e8e3e; /* Material Success/Secondary Green */
    --danger-color: #d93025; /* Material Danger Red */
    --warning-color: #e37400; /* Material Warning Orange */
    --text-color: #202124; /* Material On Surface Primary */
    --text-muted: #5f6368; /* Material On Surface Variant */
    --border-color: #dadce0; /* Material Outline */
    --card-shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
    --card-shadow-hover: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);
    --elevation-1: 0 1px 2px 0 rgba(0,0,0,0.05), 0 1px 3px 0 rgba(0,0,0,0.1);
    --elevation-2: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 280px;
}

[data-theme="dark"] {
    --bg-color: #121212; /* Material Dark surface container */
    --surface-color: #1e1e1e; /* Material Dark surface */
    --surface-variant: #2d2d2d; /* Material Dark surface variant */
    --primary-color: #8ab4f8; /* Material Dark Primary Blue */
    --primary-hover: #aecbfa;
    --on-primary: #121212;
    --secondary-color: #81c995; /* Material Dark Success Green */
    --danger-color: #f28b82; /* Material Dark Danger Red */
    --warning-color: #fdd663; /* Material Dark Warning Orange */
    --text-color: #e8eaed; /* Material On Surface Primary Dark */
    --text-muted: #9aa0a6; /* Material On Surface Variant Dark */
    --border-color: #3c4043; /* Material Outline Dark */
    --card-shadow: 0 1px 3px 0 rgba(0,0,0,0.5);
    --card-shadow-hover: 0 4px 12px 0 rgba(0,0,0,0.6);
    --elevation-1: 0 1px 3px 0 rgba(0,0,0,0.3);
    --elevation-2: 0 4px 8px 0 rgba(0,0,0,0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Vazir', sans-serif;
    direction: rtl;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    transition: var(--transition-smooth);
    padding-bottom: 72px; /* space for mobile navigation bar */
}

/* Base Layout Configs (Material Navigation Drawer & App Bar) */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Material Desktop Navigation Drawer */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface-color);
    border-left: 1px solid var(--border-color);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    height: 100vh;
    right: 0;
    top: 0;
    z-index: 100;
    transition: var(--transition-smooth);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding: 0.5rem 0.75rem;
}

.sidebar-logo svg {
    width: 28px;
    height: 28px;
    fill: var(--primary-color);
}

.sidebar-logo h1 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.2px;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-grow: 1;
}

.sidebar-menu-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 100px; /* Material 3 fully rounded navigation item pills */
    font-size: 0.92rem;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.sidebar-menu-item svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.sidebar-menu-item a:hover {
    background: var(--surface-variant);
}

.sidebar-menu-item.active a {
    background: rgba(26, 115, 232, 0.12);
    color: var(--primary-color);
    font-weight: 700;
}

[data-theme="dark"] .sidebar-menu-item.active a {
    background: rgba(138, 180, 248, 0.15);
    color: var(--primary-color);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer .theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.sidebar-footer .theme-toggle:hover {
    background: var(--surface-variant);
}

/* Main Container spacing */
.main-content {
    flex-grow: 1;
    margin-right: var(--sidebar-width);
    padding: 2rem;
    transition: var(--transition-smooth);
}

/* Material Mobile Navigation Bar */
.tabbar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    z-index: 999;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
}

.tabbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    gap: 4px;
    transition: var(--transition-smooth);
    flex-grow: 1;
}

.tabbar-item.active {
    color: var(--primary-color);
    font-weight: 700;
}

.tabbar-item svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* Mobile App Bar Header */
.mobile-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 99;
}

.mobile-title {
    font-size: 1rem;
    font-weight: 700;
}

/* Material 3 Card Component */
.premium-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px; /* Material 3 standard medium rounded corners */
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--elevation-1);
    transition: var(--transition-smooth);
}

.premium-card:hover {
    box-shadow: var(--elevation-2);
}

/* Professional Headers inside components */
.premium-header {
    margin-bottom: 1.5rem;
}
.premium-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title svg {
    width: 24px;
    height: 24px;
    fill: var(--primary-color);
}

.header-title h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.header-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Grid specifications */
.grid-premium {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* Tables styling */
.table-container-premium {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
}

.premium-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.premium-table th {
    background: var(--surface-variant);
    color: var(--text-color);
    font-weight: 700;
    padding: 0.85rem 1rem;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.premium-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    transition: var(--transition-smooth);
}

.premium-table tr:last-child td {
    border-bottom: none;
}

.premium-table tr:hover td {
    background: var(--surface-variant);
}

/* Button stylings based on Material Design 3 Button Guidelines */
.btn-premium {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.65rem 1.25rem;
    border-radius: 100px; /* Fully rounded pills for M3 */
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: var(--transition-smooth);
}

.btn-primary-premium {
    background: var(--primary-color);
    color: var(--on-primary);
}
.btn-primary-premium:hover {
    background: var(--primary-hover);
    box-shadow: var(--elevation-1);
}
.btn-primary-premium svg {
    fill: var(--on-primary);
}

.btn-secondary-premium {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}
.btn-secondary-premium:hover {
    background: rgba(26, 115, 232, 0.04);
}

.btn-danger-premium {
    background: var(--danger-color);
    color: #ffffff;
}
.btn-danger-premium:hover {
    box-shadow: var(--elevation-1);
}

/* Modern Input Elements */
.premium-form-container {
    max-width: 620px;
    margin: 1rem auto;
}

.form-group-premium {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group-premium label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-color);
}

.input-premium-wrapper input,
.input-premium-wrapper select,
.input-premium-wrapper textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px; /* Standard Material input corner radius */
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-color);
    outline: none;
    transition: var(--transition-smooth);
}

.input-premium-wrapper input:focus,
.input-premium-wrapper select:focus,
.input-premium-wrapper textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

/* Toasts and Badges */
.toast {
    background: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.85rem 1.25rem;
    box-shadow: var(--elevation-2);
    font-size: 0.9rem;
    font-weight: 500;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
}

.badge-sale {
    background: rgba(30, 142, 62, 0.1);
    color: var(--secondary-color);
}

.badge-mortality {
    background: rgba(217, 48, 37, 0.1);
    color: var(--danger-color);
}

.badge-placement {
    background: rgba(26, 115, 232, 0.1);
    color: var(--primary-color);
}

.badge-percent {
    border-radius: 100px;
}
.status-green {
    background: rgba(30, 142, 62, 0.1);
    color: var(--secondary-color);
}
.status-blue {
    background: rgba(26, 115, 232, 0.1);
    color: var(--primary-color);
}
.status-gray {
    background: rgba(95, 99, 104, 0.1);
    color: var(--text-muted);
}
.status-red {
    background: rgba(217, 48, 37, 0.1);
    color: var(--danger-color);
}

/* Avatar indicator */
.avatar-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-left: 6px;
}
.avatar-dot.status-green { background-color: var(--secondary-color); }
.avatar-dot.status-blue { background-color: var(--primary-color); }
.avatar-dot.status-gray { background-color: var(--text-muted); }
.avatar-dot.status-red { background-color: var(--danger-color); }

/* Details view panels */
.details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--surface-variant);
}
.detail-item:last-child {
    border-bottom: none;
}
.detail-label {
    font-weight: 700;
    color: var(--text-muted);
}
.detail-val {
    font-weight: 500;
}

/* Slide up animation */
.animate-slide-up {
    animation: slideUp 0.3s cubic-bezier(0, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Lists styling */
.dashboard-list {
    list-style: none;
    margin-top: 0.5rem;
}
.dashboard-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0.25rem;
    border-bottom: 1px solid var(--border-color);
}
.dashboard-list-item:last-child {
    border-bottom: none;
}
.dashboard-list-item a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
}
.dashboard-list-item a:hover {
    color: var(--primary-color);
}

/* Filters and Pagination block */
.premium-filters-form {
    background: var(--surface-variant);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}
.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}
.filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.premium-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
}
.page-numbers {
    display: flex;
    gap: 0.35rem;
}
.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.85rem;
    background: var(--surface-variant);
    transition: var(--transition-smooth);
}
.page-link.active {
    background: var(--primary-color);
    color: var(--on-primary);
    font-weight: bold;
}
.page-link:hover:not(.active):not(.disabled) {
    background: rgba(26, 115, 232, 0.08);
    color: var(--primary-color);
}
.page-link.disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.settings-divider {
    height: 1px;
    background: var(--border-color);
    margin: 1.5rem 0 1rem 0;
}
.settings-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.no-data {
    text-align: center;
    color: var(--text-muted);
    padding: 1.5rem;
    font-size: 0.9rem;
}

/* Responsive configurations */
@media (max-width: 991px) {
    .sidebar {
        display: none; /* Hide sidebar */
    }
    .main-content {
        margin-right: 0;
        padding: 1rem;
    }
    .tabbar {
        display: flex; /* Show Bottom navigation bar */
    }
    .mobile-header {
        display: flex;
    }
}
