/* ========================================
   KOPERASI DESA MERAH PUTIH - GLOBAL STYLES
   File: assets/css/style.css
   Deskripsi: Style dasar, navigasi, footer, dan komponen global.
   ======================================== */

/* --- 1. ROOT VARIABLES --- */
:root {
    --primary-red: #DC143C;
    --secondary-red: #B91C3C;
    --dark-red: #8B0000;
    --light-red: #FFE4E4;
    --white: #FFFFFF;
    --off-white: #F8F9FA;
    --light-gray: #F5F5F5;
    --gray: #6C757D;
    --dark-gray: #343A40;
    --dark: #212529;
    --success: #28A745;
    --warning: #ffe207;
    --info: #17A2B8;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.2);
    --transition: all 0.3s ease;
    --border-radius: 10px;
    --border-radius-lg: 20px;
}

/* --- 2. RESET & BASE STYLES --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: var(--white);
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- 3. TYPOGRAPHY --- */
h1,
h2,
h3,
h4,
h5,
h6 {
    line-height: 1.3;
    font-weight: 600;
    color: var(--dark);
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1rem;
    color: var(--gray);
}

a {
    text-decoration: none;
    color: var(--primary-red);
    transition: var(--transition);
}

a:hover {
    color: var(--secondary-red);
}

/* --- 4. NAVIGATION (NAVBAR) --- */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

.navbar.scrolled {
    box-shadow: var(--shadow-lg);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    object-fit: cover;
}

.brand-text {
    font-weight: bold;
    color: var(--primary-red);
    line-height: 1.2;
}

.brand-sub {
    font-size: 0.9rem;
    color: var(--dark);
}

.nav-menu {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    padding: 5px 0;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-red);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-red);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background: var(--primary-red);
    transition: var(--transition);
    border-radius: 3px;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* --- 5. PAGE HEADER (GLOBAL) --- */
/* Digunakan di halaman sub (Tentang, Layanan, dll) */
.page-header {
    background-image: url('https://i.pinimg.com/1200x/33/80/15/3380153dc8271d9ce556668d613ec325.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    padding: 120px 0 60px;
    margin-top: 70px;
    position: relative;
    overflow: hidden;
}

.page-header h1 {
    color: var(--white);
    text-align: center;
    font-size: 3rem;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.breadcrumb {
    text-align: center;
    position: relative;
    z-index: 1;
}

.breadcrumb a {
    color: var(--white);
    opacity: 0.8;
    text-decoration: none;
}

.breadcrumb a:hover {
    opacity: 1;
}

.breadcrumb span {
    color: var(--white);
    margin: 0 10px;
}

/* --- 6. SECTIONS & UTILITIES --- */
.section {
    padding: 80px 0;
}

.bg-light {
    background: var(--off-white);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    color: var(--dark);
    margin-bottom: 1rem;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--primary-red);
    border-radius: 2px;
}

.section-title-left {
    text-align: left;
}

.section-title-left::after {
    left: 0;
    transform: none;
}

.section-subtitle {
    text-align: center;
    color: var(--gray);
    margin-bottom: 3rem;
    font-size: 1.1rem;
}

/* Helper Classes */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.mt-5 {
    margin-top: 3rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.mb-5 {
    margin-bottom: 3rem;
}

.lead {
    font-size: 1.25rem;
    font-weight: 300;
}

/* --- 7. BUTTONS --- */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.btn-primary {
    background: var(--primary-red);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--secondary-red);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 20, 60, 0.3);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    color: var(--white);
    border: 2px solid var(--white);
}

.btn-outline:hover {
    background: var(--white);
    color: var(--primary-red);
}

.btn-white {
    background: var(--white);
    color: var(--primary-red);
}

.btn-white:hover {
    background: var(--off-white);
}

.btn-outline-white {
    background: transparent;
    color: var(--white);
    border: 2px solid var(--white);
}

.btn-outline-white:hover {
    background: var(--white);
    color: var(--primary-red);
}

.btn-small {
    padding: 8px 20px;
    font-size: 0.9rem;
}

.btn-block {
    width: 100%;
    display: block;
}

/* --- 8. FORMS (GENERAL) --- */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--dark);
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
    background: var(--white);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    margin: 10px 0;
}

.badge-warning {
    background: var(--warning);
    color: var(--dark);
}

.badge-success {
    background: var(--success);
    color: var(--white);
}

.badge-info {
    background: var(--info);
    color: var(--white);
}

/* --- 9. FOOTER --- */
.footer {
    background: var(--dark);
    color: var(--white);
    padding: 60px 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-column h3,
.footer-column h4 {
    color: var(--white);
    margin-bottom: 20px;
}

.footer-column p {
    color: #bbb;
    margin-bottom: 20px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #bbb;
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--white);
    padding-left: 5px;
}

.footer-contact {
    list-style: none;
}

.footer-contact li {
    color: #bbb;
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
}

.footer-contact li i {
    margin-right: 10px;
    color: var(--primary-red);
    width: 20px;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-link {
    width: 40px;
    height: 40px;
    background: var(--primary-red);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    text-decoration: none;
    transition: var(--transition);
}

.social-link:hover {
    transform: translateY(-3px);
    background: var(--secondary-red);
    color: var(--white);
}

.footer-bottom {
    border-top: 1px solid #444;
    padding-top: 20px;
    text-align: center;
    color: #bbb;
}

/* --- 10. FLOATING ELEMENTS --- */

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-red);
    color: var(--white);
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
    box-shadow: var(--shadow-lg);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--secondary-red);
    transform: translateY(-5px);
}

/* WhatsApp Float Button */
.whatsapp-float {
    position: fixed;
    bottom: 100px;
    right: 30px;
    background: #25D366;
    color: var(--white);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    z-index: 998;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    color: var(--white);
}

.whatsapp-float i {
    font-size: 2rem;
}

.whatsapp-text {
    position: absolute;
    right: 70px;
    background: var(--dark);
    color: var(--white);
    padding: 8px 15px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.whatsapp-float:hover .whatsapp-text {
    opacity: 1;
}

/* --- 11. ANIMATIONS --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 1s ease;
}

.animate-slide-up {
    animation: fadeInUp 1s ease;
}

/* --- 12. RESPONSIVE GLOBAL --- */
@media (max-width: 1024px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--white);
        flex-direction: column;
        padding: 20px;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        clip-path: circle(0% at 100% 0);
        transition: all 0.5s ease-in-out;
    }

    .nav-menu.active {
        clip-path: circle(150% at 100% 0);
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* --- 13. GLOBAL MOBILE OPTIMIZATION --- */
@media (max-width: 576px) {

    /* Core Typography Adjustment */
    html {
        font-size: 15px;
    }

    /* Slightly smaller base for scaling */

    h1 {
        font-size: 1.8rem;
        line-height: 1.3;
    }

    h2 {
        font-size: 1.6rem;
    }

    h3 {
        font-size: 1.3rem;
    }

    p {
        font-size: 1rem;
    }

    .section {
        padding: 40px 0;
    }

    /* Navbar Mobile Tweaks */
    .navbar .container {
        padding: 0.8rem 15px;
    }

    .nav-brand {
        gap: 8px;
    }

    .logo {
        width: 40px;
        height: 40px;
    }

    .brand-text {
        font-size: 0.85rem;
    }

    .brand-sub {
        font-size: 0.7rem;
        display: none;
    }

    /* Hide sub on very small screens to save header space */

    /* Mobile Menu Usability */
    .nav-menu {
        padding: 10px 20px;
        border-top: 1px solid #f0f0f0;
    }

    .nav-link {
        display: block;
        padding: 12px 0;
        border-bottom: 1px solid #f8f9fa;
        font-size: 1.05rem;
    }

    .nav-link:last-child {
        border-bottom: none;
    }

    .nav-link:hover,
    .nav-link.active {
        padding-left: 10px;
        /* Feedback on touch/active */
    }

    /* Buttons & Touch Targets */
    .btn {
        padding: 12px 25px;
        /* Larger touch target */
        font-size: 1rem;
        width: 100%;
        /* Full width buttons usually better on mobile */
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 10px;
    }

    .page-header {
        padding: 100px 0 50px;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    /* Form Inputs */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        /* Prevent zoom on focus in iOS */
        padding: 14px;
    }

    /* Floating Elements */
    .whatsapp-float {
        width: 55px;
        height: 55px;
        bottom: 90px;
        right: 20px;
    }

    .back-to-top {
        bottom: 30px;
    }
}