/* =========================================
   BASE RESET & FONTS
   ========================================= */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Poppins', sans-serif; 
}

html, body {
    overflow-x: hidden;
    width: 100%;
}

body { 
    background-color: #f0f4f8; 
    color: #334155; 
    line-height: 1.6; 
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* =========================================
   NAVIGATION
   ========================================= */
nav { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 15px 5%; 
    background: #0f172a; 
    color: white; 
    position: sticky; 
    top: 0; 
    z-index: 1000; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.15); 
}
nav .logo { 
    font-size: 1.5rem; 
    font-weight: bold; 
    color: #38bdf8; 
    flex-shrink: 0;
}
nav ul { 
    display: flex; 
    list-style: none; 
    flex-wrap: wrap; 
    gap: 5px;
}
nav ul li { 
    margin-left: 5px; 
}
nav ul li a { 
    color: #cbd5e1; 
    text-decoration: none; 
    font-weight: 500; 
    transition: 0.3s; 
    padding: 5px 10px; 
    border-radius: 5px; 
    font-size: 0.9rem; 
    white-space: nowrap;
}
nav ul li a:hover, 
nav ul li a.active { 
    background: #38bdf8; 
    color: #0f172a; 
}

/* =========================================
   PAGE HEADER
   ========================================= */
.page-header { 
    background: #1e293b; 
    padding: 60px 20px; 
    text-align: center; 
    color: white; 
    margin-bottom: 40px; 
    border-bottom: 4px solid #38bdf8; 
}
.page-header h1 { 
    font-size: 2.5rem; 
    color: #38bdf8; 
    margin-bottom: 10px; 
}

/* =========================================
   SECTIONS & GRID
   ========================================= */
section { 
    padding: 40px 5%; 
    width: 100%;
    max-width: 1400px; 
    margin: 0 auto; 
    box-sizing: border-box;
}

.grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
    gap: 30px; 
}

/* =========================================
   CARDS
   ========================================= */
.card { 
    background: white; 
    border-radius: 12px; 
    overflow: hidden; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); 
    transition: transform 0.3s, box-shadow 0.3s; 
    border-top: 4px solid #0284c7; 
    width: 100%;
}
.card:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 10px 25px rgba(0,0,0,0.1); 
}
.card video, 
.card img { 
    width: 100%; 
    height: 200px; 
    object-fit: cover; 
    border-bottom: 1px solid #e2e8f0; 
    display: block;
}
.card-content { 
    padding: 25px; 
}
.card-content h3 { 
    color: #0f172a; 
    margin-bottom: 10px; 
}

/* =========================================
   IMAGE GALLERY
   ========================================= */
.ss-gallery { 
    display: flex; 
    gap: 10px; 
    margin: 15px 0; 
    overflow-x: auto; 
    padding-bottom: 10px; 
    -webkit-overflow-scrolling: touch;
}
.ss-gallery img { 
    height: 120px; 
    width: auto; 
    flex-shrink: 0;
    border-radius: 8px; 
    border: 1px solid #e2e8f0; 
}

/* =========================================
   BUTTONS
   ========================================= */
.btn { 
    display: inline-block; 
    padding: 10px 20px; 
    background: #0284c7; 
    color: white; 
    text-decoration: none; 
    border-radius: 8px; 
    font-weight: 600; 
    transition: 0.3s; 
    margin-top: 15px; 
    margin-right: 10px; 
}
.btn:hover { 
    opacity: 0.85; 
    transform: translateY(-1px);
}
.btn-alt { background: #475569; }
.btn-whatsapp { background: #25D366; }
.btn-youtube { background: #ff0000; }
.btn-itch { background: #fa5c5c; }

/* =========================================
   CONTACT PAGE
   ========================================= */
.contact-grid { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 30px; 
    width: 100%;
    box-sizing: border-box;
}

.contact-item { 
    background: white; 
    padding: 30px; 
    border-radius: 10px; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.05); 
    border-bottom: 4px solid #38bdf8;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0; /* FIX: grid item overflow prevent karanawa */
}

/* All text inside contact items wrap properly */
.contact-item * {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* =========================================
   CV / RESUME
   ========================================= */
.cv-container { 
    width: 100%; 
    height: 70vh; 
    border: 2px solid #cbd5e1; 
    border-radius: 10px; 
    overflow: hidden; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); 
    margin-top: 20px; 
}

/* =========================================
   FOOTER
   ========================================= */
footer {
    background: #080d1a;
    color: #94a3b8;
    padding: 60px 5% 20px 5%;
    margin-top: auto;
    font-size: 0.95rem;
    width: 100%;
    box-sizing: border-box;
}

.footer-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-bottom: 40px;
    width: 100%;
    box-sizing: border-box;
}

.footer-col h3 { 
    color: #ffffff; 
    margin-bottom: 20px; 
    font-size: 1.2rem; 
}
.footer-logo { 
    font-size: 1.8rem; 
    font-weight: 900; 
    color: #38bdf8; 
    margin-bottom: 15px; 
    display: inline-block; 
    letter-spacing: 1px; 
}
.footer-logo span { 
    color: #ffffff; 
}
.footer-col p { 
    margin-bottom: 20px; 
    line-height: 1.6; 
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.footer-socials a { 
    color: #94a3b8; 
    font-size: 1.2rem; 
    margin-right: 15px; 
    text-decoration: none; 
    transition: 0.3s; 
}
.footer-socials a:hover { 
    color: #38bdf8; 
}
.footer-col ul { 
    list-style: none; 
}
.footer-col ul li { 
    margin-bottom: 12px; 
}
.footer-col ul li a { 
    color: #94a3b8; 
    text-decoration: none; 
    transition: color 0.3s, padding-left 0.3s; 
}
.footer-col ul li a:hover { 
    color: #38bdf8; 
    padding-left: 5px; 
}
.footer-bottom { 
    text-align: center; 
    padding-top: 20px; 
    border-top: 1px solid #1e293b; 
    font-size: 0.85rem; 
}

/* =========================================
   AI CHATBOT
   ========================================= */
.chat-btn { 
    position: fixed; 
    bottom: 30px; 
    right: 30px; 
    background: #38bdf8; 
    color: #0f172a; 
    border: none; 
    padding: 15px 25px; 
    border-radius: 50px; 
    font-size: 1.1rem; 
    font-weight: bold; 
    cursor: pointer; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.2); 
    z-index: 1001; 
    transition: 0.3s; 
}
.chat-btn:hover { 
    transform: scale(1.05); 
    background: #0284c7; 
    color: white; 
}

.chat-popup { 
    display: none; 
    position: fixed; 
    bottom: 90px; 
    right: 30px; 
    width: 320px; 
    background: white; 
    border-radius: 12px; 
    box-shadow: 0 5px 25px rgba(0,0,0,0.2); 
    z-index: 1001; 
    overflow: hidden; 
    flex-direction: column; 
    border: 1px solid #e2e8f0; 
}
.chat-header { 
    background: #0f172a; 
    color: white; 
    padding: 15px; 
    font-weight: bold; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}
.chat-header button { 
    background: transparent; 
    border: none; 
    color: white; 
    cursor: pointer; 
    font-size: 1.2rem; 
}

.chat-box { 
    height: 320px; 
    padding: 15px; 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
    background: #f0f4f8; 
}
.chat-msg { 
    max-width: 85%; 
    padding: 12px 15px; 
    border-radius: 15px; 
    font-size: 0.9rem; 
    line-height: 1.4; 
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.bot-msg { 
    background: white; 
    color: #334155; 
    align-self: flex-start; 
    border-bottom-left-radius: 2px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); 
}
.user-msg { 
    background: #38bdf8; 
    color: #0f172a; 
    align-self: flex-end; 
    border-bottom-right-radius: 2px; 
    font-weight: 500; 
}

.chat-input-area { 
    display: flex; 
    padding: 15px; 
    background: white; 
    border-top: 1px solid #e2e8f0; 
}
.chat-input-area input { 
    flex: 1; 
    padding: 10px 15px; 
    border: 1px solid #cbd5e1; 
    border-radius: 20px; 
    outline: none; 
    font-family: 'Poppins', sans-serif; 
    min-width: 0; /* FIX: input overflow prevent */
}
.chat-input-area button { 
    background: #0f172a; 
    color: white; 
    border: none; 
    padding: 8px 18px; 
    margin-left: 10px; 
    border-radius: 20px; 
    cursor: pointer; 
    font-weight: bold; 
    transition: 0.3s; 
    flex-shrink: 0;
}
.chat-input-area button:hover { 
    background: #0284c7; 
}

/* =========================================
   PROJECT FILTER BUTTONS
   ========================================= */
.filter-container { 
    display: flex; 
    justify-content: center; 
    gap: 15px; 
    flex-wrap: wrap; 
    margin-bottom: 40px; 
}
.filter-btn { 
    padding: 8px 25px; 
    background: transparent; 
    border: 2px solid #38bdf8; 
    color: #0f172a; 
    border-radius: 25px; 
    cursor: pointer; 
    font-weight: 600; 
    transition: 0.3s; 
    font-size: 0.95rem; 
}
.filter-btn:hover, 
.filter-btn.active { 
    background: #38bdf8; 
    color: #0f172a; 
}
.project-card.hide { 
    display: none; 
}

/* =========================================
   TABLET VIEW (max-width: 1024px)
   ========================================= */
@media (max-width: 1024px) {
    .grid { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 20px; 
    }
    
    .contact-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
    
    .page-header h1 { 
        font-size: 2rem; 
    }
    
    nav ul li a {
        font-size: 0.82rem;
        padding: 4px 8px;
    }
}

/* =========================================
   MOBILE VIEW (max-width: 768px)
   ========================================= */
@media (max-width: 768px) {
    /* Typography */
    h1 { font-size: 2rem !important; }
    h2 { font-size: 1.5rem !important; }
    .page-header h1 { font-size: 1.8rem !important; }
    .page-header { padding: 40px 15px; margin-bottom: 25px; }

    /* Section Padding */
    section {
        padding: 25px 15px;
    }

    /* Navigation */
    nav { 
        flex-direction: column; 
        align-items: flex-start;
        padding: 12px 5%;
        gap: 10px;
    }
    nav ul { 
        flex-wrap: wrap; 
        justify-content: flex-start; 
        gap: 6px;
        width: 100%;
    }
    nav ul li { 
        margin: 0; 
    }
    nav ul li a {
        font-size: 0.8rem;
        padding: 4px 8px;
    }

    /* Grid - single column */
    .grid { 
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    /* Cards full width */
    .card {
        width: 100%;
    }

    /* Images */
    img { 
        max-width: 100%; 
        height: auto; 
    }
    .card img,
    .project-card img { 
        width: 100%; 
        height: 200px; 
        object-fit: cover; 
    }

    /* Contact grid - single column */
    .contact-grid { 
        grid-template-columns: 1fr !important;
        gap: 15px;
        padding: 0;
    }

    .contact-item {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 20px !important;
    }

    /* Footer - single column */
    .footer-container { 
        grid-template-columns: 1fr !important;
        gap: 30px;
    }

    footer {
        padding: 40px 5% 20px 5%;
    }

    /* Filter buttons */
    .filter-container {
        gap: 10px;
    }
    .filter-btn {
        padding: 6px 16px;
        font-size: 0.85rem;
    }

    /* Chat button */
    .chat-btn { 
        bottom: 15px; 
        right: 15px; 
        font-size: 0.9rem; 
        padding: 10px 15px; 
    }

    /* Chat popup */
    .chat-popup {
        width: calc(100vw - 30px);
        right: 15px;
        bottom: 75px;
    }

    /* Word wrap everywhere */
    p, a, span, li, td, th {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
}

/* =========================================
   SMALL MOBILE (max-width: 480px)
   ========================================= */
@media (max-width: 480px) {
    .page-header h1 { font-size: 1.5rem !important; }
    
    nav .logo { font-size: 1.2rem; }
    
    .btn {
        display: block;
        width: 100%;
        text-align: center;
        margin-right: 0;
        margin-bottom: 8px;
    }

    .footer-logo { font-size: 1.4rem; }

    .chat-popup {
        width: calc(100vw - 20px);
        right: 10px;
    }
}
