/* Simple blue-themed styling for the app */

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

body {
    font-family: 'Vazir', tahoma, Arial, sans-serif;
    background-color: #f2f6fc;
    margin: 0;
    padding: 0;
    direction: rtl;
    font-size: 15px;
}

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

img {
    max-width: 100%;
    height: auto;
}

/* Layout with Sidebar */
.layout-container {
    display: flex;
    min-height: 100vh;
    direction: rtl;
}

/* Sidebar Styles */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #0d47a1, #1565c0);
    color: #fff;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1050;
    transition: transform 0.3s ease;
    -webkit-overflow-scrolling: touch;
}

.sidebar-header {
    padding: 25px 20px;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    margin: 0;
    font-size: 20px;
    color: #fff;
    font-weight: 600;
}

.sidebar-nav {
    padding: 15px 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 15px;
    transition: all 0.2s ease;
    border-right: 3px solid transparent;
}

.sidebar-icon {
    font-size: 18px;
    display: inline-block;
    min-width: 24px;
    text-align: center;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-right-color: rgba(255, 255, 255, 0.3);
}

.sidebar-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-weight: 600;
    border-right-color: #90caf9;
}

.sidebar-link.sub {
    padding: 10px 20px 10px 35px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
}

.sidebar-link.sub:hover {
    background: rgba(255, 255, 255, 0.08);
    padding-right: 38px;
}

.sidebar-link.sub.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-right-color: #64b5f6;
}

.sidebar-section {
    margin: 8px 0;
}

.sidebar-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px 8px 20px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.sidebar-section-title .sidebar-icon {
    font-size: 16px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-right: 260px;
    background: #f2f6fc;
    min-height: 100vh;
}

.sidebar-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 24px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 6px;
    line-height: 1;
    transition: background 0.2s ease;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.container {
    max-width: 1000px;
    margin: 40px auto;
    background: #ffffff;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #0d47a1, #1976d2);
    color: #fff;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.header h1 {
    margin: 0;
    font-size: 24px;
}

.header .user-info {
    font-size: 15px;
}


.content {
    padding: 25px 30px 30px 30px;
}

h2 {
    margin-top: 0;
    color: #0d47a1;
}

form {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 9px 11px;
    margin-bottom: 10px;
    border-radius: 6px;
    border: 1px solid #cfd8dc;
    box-sizing: border-box;
    font-size: 14px;
}

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

button,
input[type="submit"] {
    background-color: #1976d2;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 9px 18px;
    font-size: 14px;
    cursor: pointer;
}

button:hover,
input[type="submit"]:hover {
    background-color: #0d47a1;
}

/* Buttons (generic) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.25);
}

.btn-sm {
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 7px;
}

.btn-primary {
    background: #1976d2;
    border-color: #1976d2;
    color: #fff;
}
.btn-primary:hover {
    background: #0d47a1;
    border-color: #0d47a1;
    color: #fff;
}

.btn-secondary {
    background: #ffffff;
    border-color: #bbdefb;
    color: #0d47a1;
}
.btn-secondary:hover {
    background: #e3f2fd;
    border-color: #90caf9;
    color: #0d47a1;
}

.btn-danger {
    background: #c62828;
    border-color: #c62828;
    color: #fff;
}
.btn-danger:hover {
    background: #b71c1c;
    border-color: #b71c1c;
    color: #fff;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 14px;
}

th,
td {
    padding: 8px;
    border-bottom: 1px solid #eceff1;
    text-align: right;
}

th {
    background-color: #e3f2fd;
    color: #0d47a1;
}

.message {
    padding: 11px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

.message.success {
    background-color: #e8f5e9;
    color: #1b5e20;
}

.message.error {
    background-color: #ffebee;
    color: #b71c1c;
}

.login-wrapper {
    max-width: 400px;
    margin: 80px auto;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.08);
    padding: 25px 30px 30px 30px;
}

.login-brand {
    text-align: center;
    margin-top: 0;
    margin-bottom: 18px;
}

.brand-line {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1.35;
}

.brand-line--green {
    color: #1b5e20;
    font-weight: 800;
    font-size: 18px;
}

.brand-line--blue {
    color: #0d47a1;
    font-weight: 700;
    font-size: 16px;
    margin-top: 6px;
    display: block;
}

.leaf {
    width: 14px;
    height: 14px;
    display: inline-block;
    background: linear-gradient(135deg, #2e7d32, #66bb6a);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-35deg);
    box-shadow: 0 2px 6px rgba(46, 125, 50, 0.25);
}

.text-center {
    text-align: center;
}

.mt-10 {
    margin-top: 10px;
}

.stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1 1 220px;
    background: #e3f2fd;
    padding: 14px 16px;
    border-radius: 8px;
}

.stat-card h3 {
    margin: 0 0 6px 0;
    font-size: 15px;
    color: #0d47a1;
}

.stat-card p {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
}

/* ریسپانسیو عمومی */

@media (max-width: 1200px) {
    .main-content {
        margin-right: 240px;
    }
    
    .sidebar {
        width: 240px;
    }
}

@media (max-width: 992px) {
    .main-content {
        margin-right: 0;
        width: 100%;
    }

    .sidebar {
        transform: translateX(100%);
        width: 280px;
        max-width: 85vw;
    }

    .sidebar.active {
        transform: translateX(0);
        overflow-y: auto;
        overflow-x: hidden;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .sidebar-toggle {
        display: block;
    }

    .container {
        max-width: 100%;
        margin: 20px auto;
        border-radius: 0;
    }

    .content {
        padding: 20px 15px 25px 15px;
        overflow-x: auto;
    }

    .header {
        padding: 15px 20px;
    }

    /* جلوگیری از تداخل اسکرول با باز شدن منو */
    body.sidebar-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .header {
        flex-wrap: wrap;
    }

    .header h1 {
        flex: 1;
        min-width: 200px;
    }

    .stats {
        flex-direction: column;
    }

    .stat-card {
        flex: 1 1 100%;
    }

    .login-wrapper {
        margin: 40px 10px;
    }
}

@media (max-width: 520px) {
    .header h1 {
        font-size: 18px;
        line-height: 1.35;
    }

    .header .user-info {
        font-size: 13px;
    }

    .sidebar {
        width: 280px;
    }

    button,
    input[type="submit"] {
        width: 100%;
    }

    .login-wrapper {
        padding: 20px 16px 22px 16px;
    }

    input[type="text"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    textarea,
    select {
        font-size: 16px;
    }
}

/* جدول‌ها روی موبایل اسکرول افقی داشته باشند */

@media (max-width: 768px) {
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive table {
        min-width: 650px;
    }

    th, td {
        padding: 6px;
        font-size: 13px;
    }
}

.table-responsive {
    width: 100%;
}
