/* ============================================
   CJK Construction - Modern CSS
   ============================================ */

/* CSS Variables for easy theming */
:root {
    --primary-purple: #7c648c;
    --primary-gold: #bfb839;
    --accent-maroon: #930;
    --bg-cream: #ebe8e1;
    --text-dark: #333;
    --text-light: #666;
    --white: #ffffff;
    --shadow: rgba(0, 0, 0, 0.1);
    --max-width: 1200px;
}

/* ============================================
   Reset & Base Styles
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-light);
    background-color: var(--bg-cream);
    background-image: url(../images/templatemo_body.jpg);
    background-repeat: no-repeat;
    background-position: center 100
px;
    background-attachment: fixed;
}

a {
    color: var(--primary-gold);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-maroon);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-dark);
    font-weight: 600;
    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; }

p {
    margin-bottom: 1rem;
}

/* ============================================
   Layout
   ============================================ */

#wrapper {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 10px;
}

.container {
    max-width: 100%;
    margin: 0 auto;
}

/* ============================================
   Header & Navigation
   ============================================ */

#header {
    padding: 10px 50px;
    margin-bottom: 20px;
}

/* Sticky Header */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-cream);
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.3s ease;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    padding-left: calc(50vw - 50%);
    padding-right: calc(50vw - 50%);
}

.sticky-header.scrolled {
    padding: 20px 0;
    box-shadow: 0 4px 12px var(--shadow);
}

#header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

#logo h1 {
    margin: 0;
    padding: 0;
}

#logo h1 a {
    display: block;
    width: 500px;
    height: 75px;
    background: url(../images/cjk.png) no-repeat center;
    background-size: contain;
    text-indent: -9999px;
    overflow: hidden;
}

/* Mobile Menu Toggle */
#mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#mobile-menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--primary-purple);
    transition: all 0.3s ease;
}

#mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

#mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

#mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Navigation Menu */
#main-nav {
    margin-top: 20px;
}

#nav-menu {
    list-style: none;
    display: flex;
    gap: 2px;
}

#nav-menu li {
    position: relative;
}

#nav-menu > li > a {
    display: block;
    padding: 8px 15px;
    color: var(--primary-purple);
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

#nav-menu > li > a:hover,
#nav-menu > li > a.active {
    background: var(--primary-purple);
    color: var(--white);
}

/* Ensure submenu-parent links work on desktop */
.submenu-parent {
    cursor: pointer;
}

/* Submenu Toggle Button - Hidden on desktop, shown on mobile */
.submenu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--primary-purple);
    cursor: pointer;
    padding: 8px 15px;
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.submenu-toggle span {
    display: inline-block;
    transition: transform 0.3s ease;
}

.has-submenu.submenu-open .submenu-toggle span {
    transform: rotate(180deg);
}

/* Submenu */
.submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--primary-purple);
    min-width: 180px;
    list-style: none;
    box-shadow: 0 4px 6px var(--shadow);
    z-index: 1000;
}

.has-submenu:hover .submenu {
    display: block;
}

.submenu li a {
    display: block;
    padding: 10px 15px;
    color: var(--white);
    font-size: 0.95rem;
    white-space: nowrap;
}

.submenu li a:hover {
    background: var(--white);
    color: var(--primary-purple);
}

/* ============================================
   Main Content
   ============================================ */

#main-content {
    min-height: 400px;
}

.content-box {
    position: relative;
    background: var(--white);
    padding: 70px 70px 70px 76px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px var(--shadow);
}

/* Corner Decorations */
.corner-decoration {
    position: absolute;
    width: 106px;
    height: 104px;
    top: -5px;
    left: -6px;
    background-size: contain;
    background-repeat: no-repeat;
}

.corner-home { background-image: url(../images/homeCorner.png); }
.corner-about { background-image: url(../images/aboutCorner.png); }
.corner-mission { background-image: url(../images/missionCorner.png); }
.corner-services { background-image: url(../images/servicesCorner.png); }
.corner-portfolio { background-image: url(../images/portfolioCorner.png); }
.corner-contact { background-image: url(../images/contactCorner.png); }
.corner-bids { background-image: url(../images/bidCorner.png); }
.corner-login { background-image: url(../images/loginCorner.png); }
.corner-projects { background-image: url(../images/projectsCorner.png); }

.content-header {
    padding-bottom: 15px;
    color: var(--primary-purple);
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: underline;
    letter-spacing: 3px;
    margin-bottom: 20px;
}

.content-image {
    float: left;
    margin: 0 20px 15px 0;
    max-width: 200px;
}

.content-text {
    font-size: 1rem;
    line-height: 1.8;
}

/* ============================================
   Gallery
   ============================================ */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin: 30px 0;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    box-shadow: 0 4px 8px var(--shadow);
    transition: transform 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* ============================================
   Forms
   ============================================ */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-purple);
}

textarea.form-control {
    min-height: 150px;
    resize: vertical;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background: var(--primary-gold);
    color: var(--text-dark);
}

.btn-primary:hover {
    background: #a89f3a;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow);
}

.btn-secondary {
    background: var(--primary-purple);
    color: var(--white);
}

.btn-secondary:hover {
    background: #6b5579;
}

.btn-danger {
    background: #dc3545;
    color: var(--white);
}

.btn-danger:hover {
    background: #c82333;
}

.btn-success {
    background: #28a745;
    color: var(--white);
}

.btn-success:hover {
    background: #218838;
}

/* ============================================
   Tables
   ============================================ */

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: var(--white);
    box-shadow: 0 2px 4px var(--shadow);
}

thead {
    background: var(--primary-purple);
    color: var(--white);
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

tr:hover {
    background: #f5f5f5;
}

/* ============================================
   Cards
   ============================================ */

.card {
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px var(--shadow);
}

.card-header {
    border-bottom: 2px solid var(--primary-purple);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.card-title {
    font-size: 1.25rem;
    color: var(--primary-purple);
    margin: 0;
}

/* Bids grid layout */
.bids-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

/* ============================================
   Alerts & Messages
   ============================================ */

.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 0.95rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ============================================
   Footer
   ============================================ */

#footer {
    clear: both;
    text-align: center;
    padding: 30px 0;
    margin-top: 40px;
    color: var(--text-dark);
    font-size: 0.9rem;
}

#footer a {
    color: var(--text-dark);
}

#footer a:hover {
    color: var(--primary-purple);
}

/* ============================================
   Utility Classes
   ============================================ */

.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden { display: none; }

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    #header .container {
        flex-direction: column;
        align-items: flex-start;
    }

    #mobile-menu-toggle {
        display: flex;
        position: absolute;
        top: 25px;
        right: 20px;
    }

    #main-nav {
        width: 100%;
        margin-top: 10px;
    }

    #nav-menu {
        flex-direction: column;
        gap: 0;
        display: none !important;
        background: var(--white);
        border-radius: 4px;
        box-shadow: 0 4px 8px var(--shadow);
        overflow: hidden;
    }

    #nav-menu.active {
        display: flex !important;
    }

    #nav-menu > li {
        border-bottom: 1px solid #eee;
    }

    #nav-menu > li:last-child {
        border-bottom: none;
    }

    #nav-menu > li {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
    }

    #nav-menu > li > a {
        padding: 15px 20px;
        display: block;
        flex: 1;
    }

    /* Show submenu toggle button on mobile */
    .submenu-toggle {
        display: block;
        padding: 15px 20px;
        color: var(--primary-purple);
    }

    /* Hide the parent link's submenu indicator on desktop since we have toggle button */
    .has-submenu > a::after {
        display: none;
    }

    /* Submenu styling for mobile */
    .submenu {
        position: static;
        box-shadow: none;
        background: #f8f8f8;
        min-width: auto;
        width: 100%;
        display: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        flex-basis: 100%;
    }

    .has-submenu.submenu-open .submenu {
        display: block;
        max-height: 500px;
    }

    .submenu li {
        border-bottom: 1px solid #e0e0e0;
    }

    .submenu li:last-child {
        border-bottom: none;
    }

    .submenu li a {
        color: var(--primary-purple);
        padding: 12px 20px 12px 40px;
        display: block;
        background: transparent;
    }

    .submenu li a:hover {
        background: var(--primary-purple);
        color: var(--white);
    }

    .content-box {
        padding: 50px 30px 30px 40px;
    }

    .content-image {
        float: none;
        margin: 0 auto 20px;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .bids-grid {
        grid-template-columns: 1fr;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    #logo h1 a {
        width: 200px;
        height: 50px;
    }

    .content-box {
        padding: 40px 20px 20px 30px;
    }

    .corner-decoration {
        width: 80px;
        height: 78px;
    }

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
}
