/* IRANSans Font */
@font-face {
    font-family: 'IRANSans';
    src: url('../IRANSans.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Apply IRANSans to entire application */
body, html {
    font-family: 'IRANSans', Tahoma, Arial, sans-serif !important;
    overflow-x: hidden;
}

/* Apply to all elements */
* {
    font-family: 'IRANSans', Tahoma, Arial, sans-serif !important;
}

/* Specific elements */
.navbar,
.card,
.btn,
.form-control,
.form-label,
.form-select,
.table,
.alert,
.badge,
.list-group-item,
input,
textarea,
select,
button,
h1, h2, h3, h4, h5, h6,
p, span, div, a {
    font-family: 'IRANSans', Tahoma, Arial, sans-serif !important;
}

/* ==================== Mobile Responsive Styles ==================== */

/* Container adjustments for mobile */
.container-fluid {
    padding-right: 10px;
    padding-left: 10px;
}

/* Cards - Better mobile spacing */
.card {
    margin-bottom: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.card-body {
    padding: 15px;
}

.card-header {
    padding: 12px 15px;
    border-radius: 10px 10px 0 0 !important;
}

/* Buttons - Larger touch targets for mobile */
.btn {
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 8px;
    min-height: 44px; /* iOS recommended touch target */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.btn-sm {
    padding: 8px 15px;
    font-size: 13px;
    min-height: 38px;
}

/* Form elements - Better for touch */
.form-control,
.form-select {
    padding: 12px 15px;
    font-size: 16px; /* Prevents zoom on iOS */
    border-radius: 8px;
    min-height: 48px;
}

.form-label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Navigation improvements */
.navbar {
    padding: 10px 15px;
}

.navbar-brand {
    font-size: 18px;
}

.nav-link {
    padding: 10px 12px !important;
    font-size: 14px;
}

/* Lists - Better spacing */
.list-group-item {
    padding: 15px;
    margin-bottom: 8px;
    border-radius: 8px !important;
}

/* Alerts */
.alert {
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 14px;
}

/* Tables - Responsive wrapper */
.table-responsive {
    border-radius: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    font-size: 14px;
}

.table td,
.table th {
    padding: 12px 10px;
    white-space: nowrap;
}

/* Stats cards */
.card.text-white h5 {
    font-size: 14px;
    margin-bottom: 10px;
}

.card.text-white h2 {
    font-size: 28px;
    margin: 0;
}

/* Progress bars */
.progress {
    height: 8px;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    border-radius: 10px;
}

/* Badges */
.badge {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* Priority and status indicators */
.priority-low,
.priority-medium,
.priority-high,
.priority-urgent {
    font-size: 16px;
}

/* ==================== Mobile-specific Media Queries ==================== */

/* Small devices (phones, less than 768px) */
@media (max-width: 767.98px) {
    /* Typography */
    h1 {
        font-size: 24px !important;
    }

    h2 {
        font-size: 20px !important;
        margin-bottom: 15px !important;
    }

    h3 {
        font-size: 18px !important;
    }

    h4, h5 {
        font-size: 16px !important;
    }

    h6 {
        font-size: 14px !important;
    }

    /* Container */
    .container-fluid {
        padding-right: 8px;
        padding-left: 8px;
    }

    .mt-4, .my-4 {
        margin-top: 15px !important;
    }

    .mb-4, .my-4 {
        margin-bottom: 15px !important;
    }

    /* Navigation */
    .navbar-nav {
        margin-top: 10px;
    }

    .navbar-nav .nav-link {
        padding: 12px 15px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .navbar-collapse {
        max-height: 400px;
        overflow-y: auto;
    }

    /* Cards in grid */
    .row > [class*='col-'] {
        padding-right: 8px;
        padding-left: 8px;
        margin-bottom: 15px;
    }

    .card-body {
        padding: 12px;
    }

    .card-header {
        padding: 10px 12px;
        font-size: 15px;
    }

    /* Stats cards - Stack on mobile */
    .col-md-3 {
        margin-bottom: 12px;
    }

    .card.text-white h5 {
        font-size: 13px;
    }

    .card.text-white h2 {
        font-size: 24px;
    }

    /* Buttons - Full width on mobile for primary actions */
    .d-flex.justify-content-between .btn:not(.btn-sm) {
        flex: 1;
        margin: 0 3px;
    }

    .card-header .btn {
        font-size: 13px;
        padding: 8px 12px;
    }

    /* Forms */
    .row > .col-md-6,
    .row > .col-md-8 {
        margin-bottom: 12px;
    }

    /* Tables - Better scrolling */
    .table-responsive {
        margin: -12px;
        padding: 12px;
    }

    .table {
        font-size: 13px;
    }

    .table td,
    .table th {
        padding: 10px 8px;
        font-size: 13px;
    }

    /* List items */
    .list-group-item {
        padding: 12px;
    }

    .list-group-item h6 {
        font-size: 14px !important;
    }

    .list-group-item .small,
    .list-group-item small {
        font-size: 12px !important;
    }

    /* Hide less important info on mobile */
    .d-none-mobile {
        display: none !important;
    }

    /* Project cards */
    .col-md-6.col-lg-4 {
        padding: 0 8px;
    }

    /* Better spacing for action buttons */
    .btn-group-mobile {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }

    .btn-group-mobile .btn {
        flex: 1;
        min-width: 120px;
    }
}

/* Extra small devices (very small phones, less than 576px) */
@media (max-width: 575.98px) {
    /* Even tighter spacing */
    .container-fluid {
        padding: 5px;
    }

    .card {
        border-radius: 8px;
        margin-bottom: 12px;
    }

    .card-body {
        padding: 10px;
    }

    h2 {
        font-size: 18px !important;
    }

    /* Single column layout */
    .row {
        margin-right: -5px;
        margin-left: -5px;
    }

    .row > * {
        padding-right: 5px;
        padding-left: 5px;
    }

    /* Smaller buttons on very small screens */
    .btn {
        padding: 8px 15px;
        font-size: 13px;
    }

    .btn-sm {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* Form adjustments */
    .form-control,
    .form-select {
        padding: 10px 12px;
        font-size: 16px;
    }

    /* Stats cards - Even smaller */
    .card.text-white h2 {
        font-size: 22px;
    }

    .card.text-white h5 {
        font-size: 12px;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .container-fluid {
        padding-right: 15px;
        padding-left: 15px;
    }

    .card-body {
        padding: 18px;
    }

    /* Two column layout for stats */
    .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Touch-friendly improvements for all mobile devices */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    a, button, .btn, .nav-link, .list-group-item {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Remove hover effects on touch devices */
    .list-group-item:hover {
        background-color: inherit;
    }

    /* Better tap highlight */
    * {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
}

/* Landscape mode optimizations */
@media (max-width: 767.98px) and (orientation: landscape) {
    .navbar-collapse {
        max-height: 250px;
    }

    .card.text-white {
        display: inline-block;
        width: 48%;
        margin: 1%;
    }
}

/* Dark mode support (if browser prefers) */
@media (prefers-color-scheme: dark) {
    /* You can add dark mode styles here if needed */
}

/* Utility classes for mobile */
.mobile-flex-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (max-width: 767.98px) {
    .mobile-flex-column {
        flex-direction: column !important;
    }

    /* Better header alignment on mobile */
    .d-flex.justify-content-between.align-items-center {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px;
    }

    .d-flex.justify-content-between.align-items-center > * {
        width: 100%;
    }

    .d-flex.justify-content-between.align-items-center .btn {
        width: 100%;
    }

    /* Card header specific */
    .card-header.d-flex {
        flex-direction: row !important;
        flex-wrap: wrap;
        gap: 8px;
    }

    .card-header.d-flex h5,
    .card-header.d-flex h6 {
        flex: 1 1 auto;
        margin-bottom: 0 !important;
    }

    .card-header.d-flex .btn {
        width: auto !important;
        flex-shrink: 0;
    }

    /* Improve date display on mobile */
    .d-flex.w-100.justify-content-between small {
        font-size: 11px;
        white-space: nowrap;
    }

    /* Better overflow handling */
    .card-title,
    .list-group-item h6 {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .card-header .btn {
        display: none;
    }

    .card {
        break-inside: avoid;
    }
}
