:root {
    --primary-color: #3f2a8e;
    --accent-color: #f59f00;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.page {
    min-height: 100vh;
}

.page-header {
    width: 100%;
}

.page-header .row {
    margin: 0;
}

.page-header [class*="col-"] {
    padding: 0.5rem;
}

.page-header h1 {
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.navbar-vertical {
    min-height: 100vh;
    width: 250px;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.navbar-vertical.collapsed {
    transform: translateX(-100%);
}

.datatable {
    width: 100% !important;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    background-size: cover;
    background-position: center;
}

.avatar-lg {
    width: 80px;
    height: 80px;
    font-size: 1.5rem;
}

.card-img-top {
    object-fit: cover;
    height: 200px;
}

.card {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.card-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#pdfContainer {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 100%;
    overflow: hidden;
}

#pdfCanvas {
    width: 100%;
    height: 100%;
}

#pdfLoading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.handle {
    cursor: move;
    padding: 0.5rem;
    color: #666;
}

.handle:hover {
    color: #333;
}

.list-group-item.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.badge.bg-warning {
    color: #000;
}

.footer {
    margin-top: 2rem;
}

.embed-responsive {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    overflow: hidden;
}

.embed-responsive::before {
    display: block;
    content: "";
}

.embed-responsive > * {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.ql-editor {
    min-height: 200px;
}

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

.report-view video {
    max-width: 100%;
    height: auto;
}

.site-name-odia {
    font-family: 'Noto Sans Odia', sans-serif;
}

.modal {
    z-index: 1050;
}

.modal-dialog {
    max-width: 95%;
    margin: 0.5rem auto;
}

.modal-content {
    max-height: 90vh;
    overflow-y: auto;
}

.modal-body {
    overflow-x: hidden;
}

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

/* ========== MOBILE RESPONSIVE STYLES ========== */

@media (max-width: 576px) {
    /* Header */
    .page-header {
        padding: 0.5rem 0;
    }
    
    .page-header .container-xl {
        padding: 0 0.75rem;
    }
    
    .page-header h1 {
        font-size: 1.1rem !important;
    }
    
    .page-header h2 {
        font-size: 1rem !important;
    }
    
    .page-header p {
        font-size: 0.7rem;
    }
    
    .page-header img {
        height: 40px !important;
        width: auto;
    }
    
    /* Navigation buttons */
    .nav-buttons {
        padding: 0.5rem 0;
        flex-wrap: wrap;
        justify-content: center !important;
        gap: 4px !important;
    }
    
    .nav-buttons .col-auto {
        flex: 0 0 auto;
    }
    
    .nav-buttons .btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
        border-radius: 4px;
    }
    
    /* Carousel */
    .carousel-item img {
        height: 150px !important;
        object-fit: cover;
    }
    
    .carousel-caption {
        padding: 0.5rem;
    }
    
    .carousel-caption h5 {
        font-size: 0.85rem;
    }
    
    .carousel-caption p {
        font-size: 0.7rem;
        display: none;
    }
    
    /* Cards */
    .card {
        margin-bottom: 1rem;
    }
    
    .card-img-top {
        height: 140px !important;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .card-title {
        font-size: 0.95rem;
        font-weight: 600;
        -webkit-line-clamp: 2;
    }
    
    .card-text {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
    }
    
    /* Grid columns */
    .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }
    
    .col-6, .col-md-6, .col-lg-4, .col-md-4, .col-md-3 {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        margin-bottom: 0.75rem;
    }
    
    /* Forms */
    .form-control, .form-select {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    .form-label {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
    }
    
    .btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.875rem;
        border-radius: 4px;
    }
    
    /* Tables */
    .table {
        font-size: 0.8rem;
    }
    
    .table th, .table td {
        padding: 0.5rem;
    }
    
    /* Modals */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-header {
        padding: 0.75rem;
    }
    
    .modal-header h5 {
        font-size: 1rem;
    }
    
    .modal-body {
        padding: 0.75rem;
    }
    
    /* Sidebar */
    .navbar-brand {
        padding: 0.75rem;
    }
    
    .navbar-brand img {
        max-height: 35px;
    }
    
    .navbar-brand div {
        font-size: 0.9rem !important;
    }
    
    .navbar-vertical .nav-link {
        padding: 0.6rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .navbar-vertical .nav-link-icon {
        width: 20px;
        height: 20px;
        margin-right: 0.5rem;
    }
    
    /* Pagination */
    .pagination {
        font-size: 0.8rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    /* Section headings */
    h3, .h3 {
        font-size: 1rem;
        margin-bottom: 0.75rem !important;
    }
    
    h4 {
        font-size: 0.95rem;
    }
    
    /* Alerts */
    .alert {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    
    /* Labels and text */
    .text-muted, .small, small {
        font-size: 0.7rem;
    }
    
    /* Journalistic bar */
    .journalist-bar {
        padding: 0.5rem 0;
    }
    
    .journalist-bar img, .journalist-bar .journalist-photo {
        width: 50px !important;
        height: 50px !important;
    }
    
    .journalist-bar .journalist-name {
        font-size: 0.7rem;
    }
    
    /* Newspaper issues */
    #pdfContainer {
        height: 300px !important;
    }
    
    /* Admin dashboard */
    .page-body {
        padding: 0.75rem;
    }
    
    .page-title {
        font-size: 1.1rem;
    }
    
    /* Buttons */
    .btn-group {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .btn-group .btn {
        margin-bottom: 0.25rem;
    }
    
    /* Image editor */
    .image-editor-container {
        padding: 0.5rem;
    }
    
    /* Search */
    #journalistSearch, #archiveSearch {
        font-size: 0.875rem;
    }
    
    /* Cards in list */
    .journalistsListContainer .card,
    .archivesList .card,
    .videosList .card {
        margin-bottom: 0.75rem;
    }
    
    .journalistsListContainer .card img,
    .archivesList .card img,
    .videosList .card img {
        height: 120px !important;
    }
    
    /* News page */
    .news-card .card-body {
        padding: 0.6rem;
    }
    
    /* Contact page */
    .contact-header {
        padding: 1.5rem 0 !important;
    }
    
    .contact-header h1 {
        font-size: 1.25rem !important;
    }
    
    /* About page */
    .about-header {
        padding: 1.5rem 0 !important;
    }
    
    /* Footer */
    .footer {
        margin-top: 1rem;
        padding: 1rem 0;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .page-header h1 {
        font-size: 1.35rem;
    }
    
    .page-header h2 {
        font-size: 1.1rem;
    }
    
    .carousel-item img {
        height: 200px !important;
    }
    
    .card-img-top {
        height: 150px;
    }
    
    .nav-buttons .btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .col-md-6 {
        margin-bottom: 1rem;
    }
    
    #pdfContainer {
        height: 400px !important;
    }
}

@media (min-width: 769px) and (max-width: 992px) {
    .carousel-item img {
        height: 280px !important;
    }
    
    .card-img-top {
        height: 180px;
    }
}

/* Touch-friendly tap targets */
@media (hover: none) {
    .btn:active {
        transform: scale(0.97);
    }
    
    .card:active {
        transform: translateY(-2px);
    }
    
    a:active {
        opacity: 0.85;
    }
    
    .nav-link:active {
        background: rgba(255,255,255,0.1);
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .page-break {
        page-break-after: always;
    }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
    .carousel-item img {
        height: 120px !important;
    }
    
    .modal-dialog {
        max-width: 80%;
    }
}

/* Extra small devices */
@media (max-width: 400px) {
    .nav-buttons .btn {
        padding: 0.25rem 0.4rem;
        font-size: 0.65rem;
    }
    
    .page-header h1 {
        font-size: 1rem !important;
    }
    
    .card-title {
        font-size: 0.85rem;
    }
}

/* Horizontal scrolling sections */
.horizontal-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    -webkit-scrollbar-width: thin;
    -webkit-scrollbar-color: var(--primary-color) #f0f0f0;
}

.horizontal-scroll::-webkit-scrollbar {
    height: 4px;
}

.horizontal-scroll::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.horizontal-scroll::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 2px;
}

/* Utility classes */
.w-100-mobile {
    width: 100%;
}

@media (min-width: 768px) {
    .w-100-mobile {
        width: auto;
    }
}

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

@media (min-width: 768px) {
    .text-center-mobile {
        text-align: left;
    }
}

/* Fix for modal overlay bug - prevent backdrop from covering entire page incorrectly */
.modal-backdrop {
    z-index: 1040;
}

.modal {
    z-index: 1050;
}

.modal.show {
    display: flex !important;
    align-items: flex-start;
    justify-content: center;
    padding-top: 60px;
}

body.modal-open {
    overflow: auto !important;
    padding-right: 0 !important;
}

body.modal-open > *:not(.modal):not(.modal-backdrop) {
    pointer-events: auto;
}

/* Fix horizontal overflow */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

.container-xl, .container-fluid {
    max-width: 100%;
    overflow-x: hidden;
}

/* Fix journalist cards horizontal scroll */
#journalistBarContainer {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

#journalistBarContainer .col-auto {
    flex: 0 0 auto;
}