/* Responsive Enhancements for Public Pages
 * Maintains layout integrity while improving mobile experience
 * Excludes tools individual pages as requested
 */

/* Override forced desktop layout for better responsiveness */
html {
    min-width: auto !important;
    overflow-x: hidden;
}

body {
    min-width: auto !important;
}

.container, .container-fluid {
    min-width: auto !important;
    max-width: 100%;
}

/* Enhanced Responsive Container Padding */
@media (max-width: 1400px) {
    .container-fluid:not(.admin-container),
    .container:not(.admin-container) {
        padding-left: 60px;
        padding-right: 60px;
    }
}

@media (max-width: 1200px) {
    .container-fluid:not(.admin-container),
    .container:not(.admin-container) {
        padding-left: 40px;
        padding-right: 40px;
    }
}

@media (max-width: 992px) {
    .container-fluid:not(.admin-container),
    .container:not(.admin-container) {
        padding-left: 25px;
        padding-right: 25px;
    }
}

@media (max-width: 768px) {
    .container-fluid:not(.admin-container),
    .container:not(.admin-container) {
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* Header Responsive Improvements */
@media (max-width: 992px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
    }
    
    .navbar-collapse {
        background: rgba(0, 123, 255, 0.95);
        border-radius: 8px;
        margin-top: 10px;
        padding: 10px;
    }
}

@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1rem;
    }
    
    .navbar-brand i {
        display: none; /* Hide icon on very small screens */
    }
}

/* News Ticker Responsive */
@media (max-width: 992px) {
    .news-ticker-container .row {
        flex-direction: column;
    }
    
    .news-ticker-container .col-auto {
        margin-bottom: 10px;
        text-align: center;
    }
    
    .news-ticker-content {
        animation-duration: 26s !important; /* Faster on mobile as originally set */
    }
}

@media (max-width: 768px) {
    .news-ticker-container {
        padding: 10px 0;
    }
    
    .news-ticker-label {
        font-size: 0.9rem;
        padding: 4px 12px;
    }
    
    .news-ticker-item a {
        font-size: 0.9rem;
    }
}

/* Job Cards and Content Responsive */
@media (max-width: 992px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .card-title {
        font-size: 1.1rem;
        line-height: 1.4;
    }
    
    .card-text {
        font-size: 0.95rem;
    }
    
    .btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 768px) {
    .card-title {
        font-size: 1rem;
    }
    
    .card-text {
        font-size: 0.9rem;
    }
    
    .btn-sm {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

/* Table Responsive */
@media (max-width: 992px) {
    .table-responsive {
        font-size: 0.9rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        vertical-align: middle;
    }
}

@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.85rem;
        border: none;
    }
    
    .table {
        border: none;
    }
    
    .table th,
    .table td {
        padding: 0.4rem 0.3rem;
        border: none;
    }
    
    /* Better mobile table layout */
    .table thead {
        display: none;
    }
    
    .table tbody tr {
        display: block;
        border: 1px solid #dee2e6;
        margin-bottom: 15px;
        padding: 15px;
        border-radius: 8px;
        background: #f8f9fa;
    }
    
    .table tbody td {
        display: block;
        text-align: left;
        border: none;
        padding: 8px 0;
        position: relative;
    }
    
    .table tbody td:before {
        content: attr(data-label) ": ";
        font-weight: bold;
        color: #495057;
        display: inline-block;
        width: 120px;
        margin-right: 10px;
    }
    
    /* Job listing specific mobile improvements */
    .job-card {
        margin-bottom: 1rem;
    }
    
    .job-card .card-body {
        padding: 1rem;
    }
}

/* Form Elements Responsive */
@media (max-width: 768px) {
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-group .btn {
        border-radius: 0.375rem;
        margin-top: 5px;
    }
}

/* Breadcrumb Responsive */
@media (max-width: 768px) {
    .breadcrumb {
        font-size: 0.9rem;
        padding: 0.5rem 0;
    }
    
    .breadcrumb-item + .breadcrumb-item::before {
        content: "›";
    }
}

/* Footer Responsive */
@media (max-width: 992px) {
    .footer .row > div {
        margin-bottom: 2rem;
    }
}

@media (max-width: 768px) {
    .footer {
        text-align: center;
    }
    
    .footer .row > div {
        margin-bottom: 1.5rem;
    }
    
    .footer h5 {
        font-size: 1.1rem;
    }
    
    .footer p,
    .footer a {
        font-size: 0.9rem;
    }
}

/* Search Form in Header */
@media (max-width: 992px) {
    .navbar .form-control {
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .navbar .form-control {
        min-width: 150px;
        font-size: 14px;
    }
    
    .navbar .btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.9rem;
    }
}

/* Contact and About Pages */
@media (max-width: 768px) {
    .display-4 {
        font-size: 2rem;
    }
    
    .lead {
        font-size: 1.1rem;
    }
    
    .contact-form .form-control {
        margin-bottom: 1rem;
    }
}

/* Category Pages Grid */
@media (max-width: 992px) {
    .category-grid .col-lg-4 {
        margin-bottom: 1rem;
    }
}

@media (max-width: 768px) {
    .category-grid .col-lg-4,
    .category-grid .col-md-6 {
        margin-bottom: 1rem;
    }
}

/* Job Details Page */
@media (max-width: 992px) {
    .job-details .sidebar {
        margin-top: 2rem;
    }
}

@media (max-width: 768px) {
    .job-details .important-dates {
        overflow-x: auto;
    }
    
    .job-details .custom-table {
        font-size: 0.9rem;
    }
}

/* Pagination Responsive */
@media (max-width: 768px) {
    .pagination {
        justify-content: center;
    }
    
    .pagination .page-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    /* Hide some pagination numbers on mobile */
    .pagination .page-item:not(.active):not(.disabled):nth-child(n+6):nth-last-child(n+6) {
        display: none;
    }
}

/* Alert Messages */
@media (max-width: 768px) {
    .alert {
        font-size: 0.9rem;
        padding: 0.75rem;
    }
}

/* Utility Classes for Mobile */
@media (max-width: 768px) {
    .mobile-hide {
        display: none !important;
    }
    
    .mobile-center {
        text-align: center !important;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
}

/* Ensure images are responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Prevent horizontal scroll */
body {
    overflow-x: hidden;
}

/* Homepage Tools Section - Responsive Circular Design */
.tools-section .tools-container {
    width: 100% !important;
    margin: 0 auto !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding: 10px 0;
}

.tools-section .tools-container::-webkit-scrollbar {
    height: 6px;
}

.tools-section .tools-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.tools-section .tools-container::-webkit-scrollbar-thumb {
    background: #007bff;
    border-radius: 3px;
}

.tools-section .tools-container .d-flex {
    align-items: center !important;
    height: 100% !important;
    padding: 0 15px;
    /* Prevent flex container from stretching children */
    flex-wrap: nowrap !important;
}

/* Override inline styles that might cause stretching */
.tools-section .tool-button {
    flex-shrink: 0 !important;
}

.tools-section .tool-button a {
    display: block !important;
    text-decoration: none !important;
}

.tools-section .tool-button .tool-circle {
    /* Override any inline width/height styles */
    box-sizing: border-box !important;
}

.tools-section .tool-circle {
    border-radius: 50% !important;
    transition: all 0.3s ease !important;
    flex-shrink: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    text-decoration: none !important;
    /* Force aspect ratio to prevent stretching */
    aspect-ratio: 1 / 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

.tools-section .tool-circle:hover {
    transform: translateY(-5px) scale(1.05) !important;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15) !important;
}

/* Desktop and Large Tablets (992px+) */
@media (min-width: 992px) {
    .tools-section .tools-container {
        height: 160px !important;
    }
    
    .tools-section .tools-container .d-flex {
        min-width: 900px !important;
        gap: 10px !important;
        justify-content: space-evenly !important;
    }
    
    .tools-section .tool-circle,
    .tools-section .tool-button .tool-circle {
        width: 120px !important;
        height: 120px !important;
        min-width: 120px !important;
        min-height: 120px !important;
        max-width: 120px !important;
        max-height: 120px !important;
    }
    
    .tools-section .tool-circle i {
        font-size: 2rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .tools-section .tool-circle span {
        font-size: 12px !important;
        font-weight: bold !important;
        line-height: 1.2 !important;
    }
}

/* Medium Tablets (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .tools-section .tools-container {
        height: 140px !important;
    }
    
    .tools-section .tools-container .d-flex {
        min-width: 700px !important;
        gap: 8px !important;
        justify-content: space-evenly !important;
    }
    
    .tools-section .tool-circle,
    .tools-section .tool-button .tool-circle {
        width: 100px !important;
        height: 100px !important;
        min-width: 100px !important;
        min-height: 100px !important;
        max-width: 100px !important;
        max-height: 100px !important;
    }
    
    .tools-section .tool-circle i {
        font-size: 1.6rem !important;
        margin-bottom: 0.4rem !important;
    }
    
    .tools-section .tool-circle span {
        font-size: 11px !important;
        font-weight: bold !important;
        line-height: 1.1 !important;
    }
}

/* Small Tablets and Large Phones (576px - 767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .tools-section .tools-container {
        height: 120px !important;
    }
    
    .tools-section .tools-container .d-flex {
        min-width: 600px !important;
        gap: 6px !important;
        justify-content: space-evenly !important;
    }
    
    .tools-section .tool-circle,
    .tools-section .tool-button .tool-circle {
        width: 85px !important;
        height: 85px !important;
        min-width: 85px !important;
        min-height: 85px !important;
        max-width: 85px !important;
        max-height: 85px !important;
    }
    
    .tools-section .tool-circle i {
        font-size: 1.4rem !important;
        margin-bottom: 0.3rem !important;
    }
    
    .tools-section .tool-circle span {
        font-size: 10px !important;
        font-weight: bold !important;
        line-height: 1.1 !important;
    }
}

/* Small Phones (< 576px) */
@media (max-width: 575px) {
    .tools-section .tools-container {
        height: 110px !important;
    }
    
    .tools-section .tools-container .d-flex {
        min-width: 500px !important;
        gap: 5px !important;
        justify-content: space-evenly !important;
    }
    
    .tools-section .tool-circle,
    .tools-section .tool-button .tool-circle {
        width: 75px !important;
        height: 75px !important;
        min-width: 75px !important;
        min-height: 75px !important;
        max-width: 75px !important;
        max-height: 75px !important;
    }
    
    .tools-section .tool-circle i {
        font-size: 1.2rem !important;
        margin-bottom: 0.2rem !important;
    }
    
    .tools-section .tool-circle span {
        font-size: 9px !important;
        font-weight: bold !important;
        line-height: 1 !important;
    }
}

/* Homepage tools section title - responsive */
.tools-section h2 {
    color: #333 !important;
}

@media (min-width: 992px) {
    .tools-section h2 {
        font-size: 2rem !important;
        margin-bottom: 3rem !important;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .tools-section h2 {
        font-size: 1.8rem !important;
        margin-bottom: 2.5rem !important;
    }
}

@media (max-width: 767px) {
    .tools-section h2 {
        font-size: 1.6rem !important;
        margin-bottom: 2rem !important;
    }
}

/* Tools Page (tools.php) Responsive Design */
.tools-section .category-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tools-section .category-card:hover {
    transform: translateY(-5px);
}

@media (max-width: 992px) {
    .tools-section .col-lg-4 {
        margin-bottom: 2rem;
    }
    
    .tools-section .card-body {
        padding: 2rem 1.5rem;
    }
    
    .tools-section .category-icon i {
        font-size: 2.5rem !important;
    }
    
    .tools-section .card-title {
        font-size: 1.2rem;
    }
}

@media (max-width: 768px) {
    .hero-section .display-5 {
        font-size: 2rem;
    }
    
    .hero-section .lead {
        font-size: 1.1rem;
    }
    
    .tools-section h2 {
        font-size: 1.8rem;
        margin-bottom: 2rem;
    }
    
    .tools-section .card-body {
        padding: 1.5rem 1rem;
    }
    
    .tools-section .category-icon i {
        font-size: 2rem !important;
    }
    
    .tools-section .card-title {
        font-size: 1.1rem;
    }
    
    .tools-section .card-text {
        font-size: 0.95rem;
    }
    
    .tools-section .features {
        font-size: 0.85rem;
    }
    
    .tools-section .btn {
        font-size: 0.9rem;
        padding: 0.6rem 1.2rem;
    }
}

@media (max-width: 576px) {
    .tools-section .card-body {
        padding: 1.2rem 0.8rem;
    }
    
    .tools-section .category-icon {
        margin-bottom: 1rem;
    }
    
    .tools-section .category-icon i {
        font-size: 1.8rem !important;
    }
    
    .tools-section .card-title {
        font-size: 1rem;
        margin-bottom: 0.8rem;
    }
    
    .tools-section .card-text {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .tools-section .features {
        font-size: 0.8rem;
        margin-bottom: 1rem;
    }
    
    .tools-section .btn {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
        width: 100%;
    }
}

/* Tools individual pages exclusion - maintain original layout */
.tools-individual-page {
    min-width: 1200px !important;
}

.tools-individual-page .container,
.tools-individual-page .container-fluid {
    min-width: 1200px !important;
}
