/**
 * Responsive CSS - Mobile-First Design
 * Ensures ARMS is fully responsive on all devices
 */

/* ===== MOBILE FIRST (Default for all devices) ===== */

/* Main container wrapper */
.main-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar - Hide by default, show on desktop */
.sidebar {
    width: 100% !important;
    height: auto !important;
    position: static !important;
    border-left: none !important;
    border-bottom: 2px solid #006400 !important;
    margin-bottom: 20px;
    z-index: 100;
    background-color: #f8f9fa;
}

.main-content,
.topbar {
    margin-left: 0 !important;
    flex: 1;
}

.sidebar-menu {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    border-bottom: none !important;
    border-right: 1px solid #f0f0f0;
    flex: 1;
    min-width: 150px;
}

.sidebar-menu a {
    padding: 10px 8px !important;
    font-size: 12px !important;
    text-align: center;
    display: block;
    text-decoration: none;
    color: inherit;
}

/* Body adjustments for mobile */
body {
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden;
}

/* Make containers full width on mobile */
.container,
.container-fluid {
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box;
    width: 100%;
}

/* Navbar adjustments */
.navbar {
    padding: 10px 15px !important;
}

.navbar-brand {
    font-size: 16px !important;
}

.navbar-brand img {
    height: 30px !important;
    margin-right: 5px !important;
}

/* Buttons - Make touch-friendly */
.btn,
.btn-login,
.btn-register,
.btn-apply,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-filter,
.btn-clear,
.btn-action {
    padding: 12px 16px !important;
    min-height: 44px !important;
    font-size: 16px !important;
    width: 100% !important;
    margin-bottom: 10px !important;
}

.btn-sm {
    padding: 8px 12px !important;
    min-height: 36px !important;
    width: auto !important;
    margin-right: 5px !important;
    font-size: 13px !important;
}

/* Form controls - Make larger for touchscreen */
.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    padding: 12px !important;
    font-size: 16px !important;
    min-height: 44px !important;
}

.form-label {
    font-size: 14px !important;
    margin-bottom: 8px !important;
}

/* Container widths */
.login-container,
.register-container {
    max-width: 100% !important;
    width: 100%;
    margin: 10px auto !important;
    padding: 20px !important;
    box-sizing: border-box;
}

/* Header sizing */
.section-header,
.greeting-section,
.job-header {
    padding: 20px 15px !important;
}

.section-header h1,
.greeting-section h1,
.job-header h1 {
    font-size: 24px !important;
}

/* Card sizing */
.card {
    margin-left: 10px !important;
    margin-right: 10px !important;
}

.stat-card,
.profile-card,
.content-card,
.job-card {
    padding: 15px !important;
}

/* Table responsive */
.table {
    font-size: 12px !important;
    display: block;
    border: none;
}

.table thead {
    display: none;
}

.table tbody,
.table tr {
    display: block;
    width: 100%;
    margin-bottom: 15px;
}

.table td {
    display: block;
    text-align: right;
    padding-left: 50%;
    position: relative;
    border: none;
    padding: 10px;
    padding-left: 50%;
}

.table td:before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    width: 50%;
    padding: 10px;
    font-weight: bold;
    text-align: left;
}

.table td:first-child {
    font-weight: bold;
}

/* Flex layouts */
.action-buttons {
    flex-direction: column !important;
    gap: 5px !important;
}

.action-buttons .btn {
    margin-bottom: 8px !important;
}

.job-meta {
    flex-direction: column !important;
    gap: 10px !important;
}

/* Grid adjustments */
.row {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.col-md-6,
.col-lg-8,
.col-lg-4,
.col-lg-3,
.col-md-4,
.col-md-3,
.col-md-12 {
    padding-left: 10px !important;
    padding-right: 10px !important;
}

/* Forms in columns */
.form-row {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
}

/* Navbar toggler visible on mobile */
.navbar-toggler {
    display: block !important;
    padding: 0.25rem 0.75rem;
}

/* Links and text */
h1 {
    font-size: 22px !important;
}

h2 {
    font-size: 20px !important;
}

h3 {
    font-size: 18px !important;
}

h4 {
    font-size: 16px !important;
}

h5 {
    font-size: 15px !important;
}

h6 {
    font-size: 14px !important;
}

p {
    font-size: 14px !important;
}

label {
    font-size: 14px !important;
}

/* Padding adjustments */
.content {
    padding: 15px !important;
}

/* Hide overflow */
body {
    overflow-x: hidden;
}

/* Remove horizontal scroll */
.navbar-brand img,
.sidebar img {
    max-width: 100%;
    height: auto;
}

/* Layout wrapper for proper sidebar + content structure */
.content-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    flex-shrink: 0;
}

.main-content {
    flex: 1;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Prevent content overflow */
.card,
.table-responsive,
.form-container {
    box-sizing: border-box;
    overflow-x: hidden;
}

.content {
    max-width: 100%;
}

/* ===== TABLET (768px and up) ===== */
@media (min-width: 768px) {
    body {
        display: block !important;
    }

    .sidebar {
        width: 240px !important;
        height: 100vh !important;
        position: fixed !important;
        border-left: 4px solid #006400 !important;
        border-bottom: none !important;
        padding: 0 !important;
        margin-bottom: 0;
        top: 0;
        left: 0;
        z-index: 999;
        overflow-y: auto;
        background-color: #f8f9fa;
    }

    .main-content,
    .topbar {
        margin-left: 240px !important;
        width: calc(100% - 240px);
        min-height: 100vh;
    }

    .sidebar-menu {
        flex-direction: column;
        padding-top: 10px;
    }

    .sidebar-menu li {
        border-bottom: 1px solid #f0f0f0 !important;
        border-right: none;
        flex: none;
        min-width: auto;
    }

    .sidebar-menu a {
        padding: 15px 20px !important;
        font-size: 13px !important;
        text-align: left;
    }

    /* Buttons back to normal on tablet+ */
    .btn {
        width: auto !important;
    }

    .btn-sm {
        padding: 6px 12px !important;
        font-size: 13px !important;
        margin-right: 8px !important;
    }

    .action-buttons {
        flex-direction: row !important;
        flex-wrap: wrap;
        gap: 10px !important;
    }

    .action-buttons .btn {
        margin-bottom: 0 !important;
    }

    .form-row {
        grid-template-columns: 1fr 1fr;
        gap: 20px !important;
    }

    .navbar-brand img {
        height: 40px !important;
        margin-right: 10px !important;
    }

    .login-container,
    .register-container {
        margin: 0 auto;
        width: 85%;
        max-width: 480px;
        padding: 35px !important;
        background: white;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    /* Restore table styling */
    .table {
        display: table;
        font-size: 14px !important;
    }

    .table thead {
        display: table-header-group;
    }

    .table tbody,
    .table tr {
        display: table-row;
        width: auto;
        margin-bottom: 0;
    }

    .table td {
        display: table-cell;
        text-align: left;
        padding: 12px;
        position: static;
        border: 1px solid #ddd;
    }

    .table td:before {
        display: none;
    }

    .form-control,
    .form-select {
        font-size: 14px !important;
        padding: 10px 12px !important;
        min-height: 40px !important;
    }

    .form-label {
        font-size: 13px !important;
        font-weight: 500;
        margin-bottom: 8px !important;
    }

    h1 {
        font-size: 32px !important;
    }

    h2 {
        font-size: 28px !important;
    }

    h3 {
        font-size: 24px !important;
    }

    h4 {
        font-size: 20px !important;
    }

    h5 {
        font-size: 18px !important;
    }

    h6 {
        font-size: 16px !important;
    }

    p {
        font-size: 16px !important;
    }
}

/* ===== DESKTOP (1024px and up) ===== */
@media (min-width: 1024px) {
    .navbar-toggler {
        display: none !important;
    }

    .sidebar {
        width: 240px !important;
    }

    .main-content,
    .topbar {
        margin-left: 240px !important;
        width: calc(100% - 240px);
    }

    .container,
    .container-fluid {
        padding-left: 25px !important;
        padding-right: 25px !important;
        max-width: 100%;
        margin: 0;
    }

    .card {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .login-container,
    .register-container {
        max-width: 480px;
        width: 85%;
        margin: 30px auto;
        padding: 35px !important;
        box-sizing: border-box;
        background: white;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .form-row {
        grid-template-columns: 1fr 1fr;
        gap: 20px !important;
    }

    .section-header,
    .greeting-section,
    .job-header {
        padding: 30px 25px !important;
        margin-bottom: 15px !important;
    }

    .stat-card,
    .profile-card,
    .content-card,
    .job-card {
        padding: 25px !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    }

    /* Dashboard stat cards grid */
    .row.stats-row {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }

    .row.stats-row .col-md-6,
    .row.stats-row .col-lg-3 {
        padding: 0 !important;
    }

    h1 {
        font-size: 36px !important;
        margin-bottom: 20px !important;
    }

    h2 {
        font-size: 32px !important;
    }

    h3 {
        font-size: 28px !important;
    }

    .form-control,
    .form-select,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        font-size: 15px !important;
    }

    .form-label {
        font-size: 15px !important;
    }
}

/* ===== LARGE DESKTOP (1200px and up) ===== */
@media (min-width: 1200px) {

    .main-content,
    .topbar {
        margin-left: 240px !important;
    }

    .container,
    .container-fluid {
        padding-right: 35px !important;
        padding-left: 35px !important;
    }

    .login-container,
    .register-container {
        max-width: 520px;
        margin: 40px auto;
        padding: 50px !important;
    }

    .section-header,
    .greeting-section,
    .job-header {
        padding: 35px 30px !important;
        margin-bottom: 20px !important;
    }

    .stat-card,
    .profile-card,
    .content-card,
    .job-card {
        padding: 30px !important;
    }

    .form-row {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 25px !important;
    }

    h1 {
        font-size: 38px !important;
        margin-bottom: 25px !important;
    }

    h2 {
        font-size: 34px !important;
    }

    h3 {
        font-size: 30px !important;
    }
}

/* ===== LANDSCAPE MODE ===== */
@media (max-height: 500px) {

    .greeting-section,
    .section-header,
    .job-header {
        padding: 10px 15px !important;
    }

    .sidebar {
        overflow-x: auto;
    }
}

/* ===== Print Styles ===== */
@media print {

    .navbar,
    .sidebar,
    .btn,
    .topbar {
        display: none !important;
    }

    body {
        margin-left: 0 !important;
    }

    .main-content,
    .content {
        margin-left: 0 !important;
    }

    .table {
        page-break-inside: avoid;
    }
}