/* Modern Style for JOM Website */

:root {
    --primary-color: #1e2040;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --white: #ffffff;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;

    --font-family-sans-serif: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-family-heading: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --border-radius: 0.375rem;
    --border-radius-lg: 0.5rem;
    --border-radius-xl: 0.75rem;

    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --box-shadow-xl: 0 1rem 3rem rgba(0, 0, 0, 0.175);

    --transition: all 0.15s ease-in-out;
    --transition-fast: all 0.075s ease-in-out;
    --transition-slow: all 0.3s ease-in-out;
}

/* Typography */
body {
    font-family: var(--font-family-sans-serif);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--gray-700);
    background-color: var(--white);
}

/* Text Justification for Formality and Protocol */
p,
.lead,
.text-muted,
.card-text,
.alert p,
.alert .lead,
.section-title p,
.feature-card p,
.service-content p,
.testimonial-card p,
.footer p,
.carousel-caption p,
.carousel-caption .lead,
.card-body p,
.hero-section p,
.hero-section .lead,
.section p,
.section .lead,
.offcanvas-body p,
.modal-body p,
.dropdown-item p,
.navbar-text,
.breadcrumb-item + .breadcrumb-item::before {
    text-align: justify;
    text-justify: inter-word;
}

/* Special cases for specific elements */
.alert .d-flex p,
.alert .d-flex .lead,
.card .d-flex p,
.card .d-flex .lead,
.feature-card .d-flex p,
.service-content .d-flex p {
    text-align: justify;
    text-justify: inter-word;
}

/* Ensure text in cards and sections is justified */
.card-body,
.feature-card,
.service-content,
.testimonial-card,
.alert,
.section-title,
.hero-section,
.section {
    text-align: justify;
}

/* Override center alignment for specific elements that should remain centered */
.text-center p,
.text-center .lead,
.text-center .text-muted,
.carousel-caption,
.hero-section .text-center,
.section-title.text-center,
.feature-card.text-center,
.testimonial-card.text-center {
    text-align: center;
}

/* Justify text in specific sections that should be justified */
.section .container p,
.section .container .lead,
.section .container .text-muted,
.card .card-body p,
.alert .d-flex div p,
.alert .d-flex div .lead {
    text-align: justify;
    text-justify: inter-word;
}

/* Additional text justification rules for better coverage */
.list-unstyled li,
.dropdown-menu li,
.navbar-nav li,
.breadcrumb li,
.offcanvas-body li,
.modal-body li {
    text-align: justify;
}

/* Ensure proper justification for text in flex containers */
.d-flex p,
.d-flex .lead,
.d-flex .text-muted,
.d-flex div p,
.d-flex div .lead,
.d-flex div .text-muted {
    text-align: justify;
    text-justify: inter-word;
}

/* Special handling for very short text that might not justify well */
p:not(.text-center):not(.carousel-caption p):not(.hero-section .text-center p) {
    text-align: justify;
    text-justify: inter-word;
}

/* Ensure text in specific content areas is justified */
.content p,
.content .lead,
.content .text-muted,
.main-content p,
.main-content .lead,
.main-content .text-muted {
    text-align: justify;
    text-justify: inter-word;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-family-heading);
    font-weight: 600;
    line-height: 1.2;
    color: var(--gray-900);
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.75rem;
}

h4 {
    font-size: 1.5rem;
}

h5 {
    font-size: 1.25rem;
}

h6 {
    font-size: 1rem;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    h4 {
        font-size: 1.25rem;
    }

    h5 {
        font-size: 1.125rem;
    }

    h6 {
        font-size: 1rem;
    }
}

/* Top Bar */
.top-bar {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e2040 100%);
    font-size: 0.875rem;
}

.top-bar a:hover {
    opacity: 0.8;
    transition: var(--transition);
}

/* Header */
.header {
    border-bottom: 1px solid var(--gray-200);
    transition: var(--transition);
}

.navbar-brand img {
    transition: var(--transition);
}

.navbar-brand:hover img {
    transform: scale(1.05);
}

.navbar-nav .nav-link {
    font-weight: 500;
    color: var(--gray-700);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    position: relative;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: var(--primary-color);
    background-color: var(--gray-100);
}

.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: var(--transition);
    transform: translateX(-50%);
}

.navbar-nav .nav-link:hover::after,
.navbar-nav .nav-link.active::after {
    width: 80%;
}

.dropdown-menu {
    border: none;
    box-shadow: var(--box-shadow-lg);
    border-radius: var(--border-radius-lg);
    padding: 0.5rem 0;
    margin-top: 0.5rem;
}

.dropdown-item {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: var(--transition);
}

.dropdown-item:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

/* Buttons */
.btn {
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e2040 100%);
    border: none;
    box-shadow: var(--box-shadow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-lg);
}

.btn-outline-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Cards */
.card {
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-xl);
}

.card-img-top {
    transition: var(--transition);
}

.card:hover .card-img-top {
    transform: scale(1.05);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, rgba(30, 32, 64, 1) 0%, rgba(30, 32, 64, 1) 100%);
    color: var(--white);
    padding: 6rem 0;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../images/slider-main/bg-1.jpg') center/cover;
    opacity: 0.3;
    z-index: -1;
}

.hero-content {
    position: relative;
    z-index: 1;
}

/* Carousel */
.carousel {
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--box-shadow-lg);
}

.carousel-item {
    height: 500px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.carousel-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
}

.carousel-caption {
    background: rgba(0, 0, 0, 0.7);
    border-radius: var(--border-radius);
    padding: 2rem;
    backdrop-filter: blur(10px);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

/* Sections */
.section {
    padding: 5rem 0;
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
}

.section-title h2 {
    position: relative;
    display: inline-block;
    margin-bottom: 1rem;
}

.section-title h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    width: 60px;
    height: 3px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e2040 100%);
    transform: translateX(-50%);
}

/* Features */
.feature-card {
    text-align: center;
    padding: 2rem;
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--box-shadow-xl);
}

.feature-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e2040 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: var(--white);
    font-size: 2rem;
}

/* Services */
.service-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    height: 100%;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-xl);
}

.service-image {
    height: 200px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.service-content {
    padding: 1.5rem;
}

/* Testimonials */
.testimonial-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--box-shadow);
    text-align: center;
    position: relative;
}

.testimonial-card::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 20px;
    font-size: 4rem;
    color: var(--primary-color);
    font-family: serif;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
}

.bg-darker {
    background-color: rgba(0, 0, 0, 0.2);
}

.footer h5 {
    color: var(--white);
    margin-bottom: 1.5rem;
    position: relative;
}

.footer h5::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 2px;
    background-color: var(--primary-color);
}

.footer a {
    color: var(--gray-300);
    text-decoration: none;
    transition: var(--transition);
}

.footer a:hover {
    color: var(--primary-color);
}

/* Back to Top Button */
#backToTop {
    width: 50px;
    height: 50px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

#backToTop.show {
    opacity: 1;
    visibility: visible;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.6s ease-out;
}

/* Utilities */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e2040 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e2040 100%);
}

.shadow-custom {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.rounded-custom {
    border-radius: var(--border-radius-lg);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-section {
        padding: 4rem 0;
    }

    .carousel-item {
        height: 400px;
    }

    /* Carousel caption responsive text scaling */
    .carousel-caption {
        padding: 1rem;
        left: 5%;
        right: 5%;
    }

    .carousel-caption h1 {
        font-size: 1.75rem;
        margin-bottom: 0.5rem;
    }

    .carousel-caption h2 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .carousel-caption h3 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .carousel-caption p {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .carousel-caption .fa-2x {
        font-size: 1.5rem !important;
    }

    .section {
        padding: 3rem 0;
    }

    .feature-card,
    .service-card,
    .testimonial-card {
        margin-bottom: 2rem;
    }
}

@media (max-width: 576px) {
    .carousel-item {
        height: 300px;
    }

    .hero-section {
        padding: 3rem 0;
    }

    .section {
        padding: 2rem 0;
    }

    /* Smaller phones: further reduce caption sizes */
    .carousel-caption {
        padding: 0.75rem;
        left: 1rem;
        right: 1rem;
    }

    .carousel-caption h1 {
        font-size: 1.4rem;
    }

    .carousel-caption h2 {
        font-size: 1.25rem;
    }

    .carousel-caption h3 {
        font-size: 1.25rem;
    }

    .carousel-caption p {
        font-size: 0.9rem;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--gray-300);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Print Styles */
@media print {

    .top-bar,
    .header,
    .footer,
    #backToTop {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.4;
    }

    .section {
        padding: 1rem 0;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles */
.btn:focus,
.nav-link:focus,
.dropdown-item:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0000ff;
        --secondary-color: #666666;
        --gray-700: #000000;
        --gray-900: #000000;
    }
}

/* Header responsive tweaks */
.header .fw-semibold {
    word-break: break-word;
}

.navbar-brand img {
    height: 80px;
}

@media (max-width: 768px) {
    .navbar-brand img {
        height: 60px;
    }
}

@media (max-width: 576px) {
    .navbar-brand img {
        height: 48px;
    }
}

/* Ensure general images scale on small screens inside cards/sections */
.card img,
.section img {
    max-width: 100%;
    height: auto;
}

/* Feature icon size on small screens */
@media (max-width: 576px) {
    .feature-icon {
        width: 64px;
        height: 64px;
        font-size: 1.5rem;
    }
}

/* Card paddings compact on mobile */
@media (max-width: 576px) {
    .card .card-body {
        padding: 1rem;
    }
}

/* Service image height adjustments */
@media (max-width: 768px) {
    .service-image {
        height: 160px;
    }
}

@media (max-width: 576px) {
    .service-image {
        height: 120px;
    }
}

/* Carousel height adjustments already exist; ensure captions are readable */
@media (max-width: 576px) {
    .carousel-caption {
        padding: 1rem;
        font-size: 0.9rem;
    }
}
