/* ==========================================
   Base Reset & Variables
   ========================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --text-dark: #202124;
    --text-grey: #5f6368;
    --border-color: #dadce0;
    --bg-light: #ffffff;
    --bg-body: #f8f9fa;
    --green-border: #10b981;
    --yellow-border: #f59e0b;
    --grey-border: #9ca3af;
    --btn-yellow: #facc15;
    --btn-yellow-hover: #eab308;
    --card-shadow: 0 4px 12px rgba(0,0,0,0.05);
    --card-hover-shadow: 0 8px 24px rgba(0,0,0,0.12);
    --icon-bg: rgba(16, 185, 129, 0.1);
}

/* Dark Mode Variables */
body.dark-mode {
    --text-dark: #e8eaed;
    --text-grey: #9aa0a6;
    --border-color: #3c4043;
    --bg-light: #202124;
    --bg-body: #121212;
    --card-shadow: 0 4px 12px rgba(0,0,0,0.3);
    --card-hover-shadow: 0 8px 24px rgba(0,0,0,0.5);
    --icon-bg: rgba(16, 185, 129, 0.2);
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-dark);
    background-color: var(--bg-body);
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ==========================================
   Tool Hero Section
   ========================================== */
.tool-section { 
    text-align: center; 
    padding: 40px 0; 
}

.main-title { 
    font-size: 32px; 
    margin-bottom: 8px; 
    line-height: 1.2;
}

.main-subtitle { 
    color: var(--text-grey); 
    margin-bottom: 30px; 
    font-size: 16px;
}

.solver-card {
    background: var(--bg-light);
    max-width: 440px;
    margin: 0 auto;
    padding: 30px 25px;
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--green-border); /* Slightly thicker top border for emphasis */
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    text-align: left;
    transition: background-color 0.3s, border-color 0.3s;
}

.form-group { margin-bottom: 24px; }

.group-title { 
    font-size: 16px; 
    font-weight: 600; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

.subtext { 
    font-size: 13px; 
    color: var(--text-grey); 
    margin-top: 4px;
    margin-bottom: 12px; 
    line-height: 1.4; 
}

/* Input Row Layout */
.input-row { 
    display: flex; 
    gap: 10px; 
    justify-content: space-between; /* Ensures equal spacing */
}

.letter-box {
    width: 50px;
    height: 55px;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    border: 2px solid; /* Made slightly thicker for better visibility */
    border-radius: 8px;
    outline: none;
    background: transparent;
    color: var(--text-dark);
    transition: all 0.2s ease-in-out;
}

.letter-box:focus { 
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); 
    transform: translateY(-2px); /* Slight lift on focus */
}

.green-box { border-color: var(--green-border); }
.yellow-box { border-color: var(--yellow-border); }

.excluded-input {
    width: 100%;
    height: 50px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0 15px;
    font-size: 18px;
    letter-spacing: 2px;
    text-transform: uppercase;
    outline: none;
    background: transparent;
    color: var(--text-dark);
    transition: border-color 0.2s;
}

.excluded-input:focus { border-color: var(--grey-border); }

/* Group Header (Title & Clear Button Alignment) */
.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Clear Button Styling */
.clear-btn {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-grey);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.2s ease;
}

.clear-btn:hover {
    color: #e53935; /* Hover karne par Red color hoga */
    text-decoration: underline;
}

/* Dark Mode support for clear button */
body.dark-mode .clear-btn:hover {
    color: #ff5252;
}

/* Search Button */
.search-btn {
    width: 100%;
    background-color: #6aaa64;
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    border: none;
    padding: 14px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s, transform 0.1s;
}

.search-btn:hover { background-color: #538d4e; }
.search-btn:active { transform: scale(0.98); }

/* ==========================================
   Answers Section
   ========================================== */
.answers-section {
    max-width: 1200px;
    margin: 40px auto 0;
    background: var(--bg-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.answers-header {
    background-color: #6aaa64;
    color: #ffffff;
    padding: 15px 20px;
    font-size: 18px;
    font-weight: 700;
    text-align: center; /* Centered for better look */
}

.answers-body { padding: 25px; }

.results-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: left; 
}

.result-word {
    background-color: #f3f4f6;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Dark Mode Overrides for Specifics */
body.dark-mode .answers-header { background-color: #538d4e; }
body.dark-mode .result-word { 
    background-color: #2a2a2a; 
    color: #e8eaed; 
    border-color: #444; 
}

/* =========================================
   No Results Card Styles (Not Found Section)
   ========================================= */
.no-results-card {
    text-align: center;
    padding: 40px 20px;
    width: 100%;
    background: var(--bg-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
}

.no-results-title {
    font-size: 26px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.no-results-text {
    font-size: 16px;
    color: var(--text-grey);
    margin-bottom: 25px;
    line-height: 1.6;
}

.btn-secondary {
    display: inline-block;
    background-color: #6aaa54;
    color: #fff;
    padding: 12px 35px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 16px;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-secondary:hover { background-color: #538d5e; }
.btn-secondary:active { transform: scale(0.98); }

/* ==========================================
   Sections & Dividers
   ========================================== */
.section-divider {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 60px 0;
}

.about-section h2, .how-to-use-section h2, .faq-section h2 {
    font-size: 28px;
    margin-bottom: 25px;
    text-align: center;
}

.about-section p { 
    margin-bottom: 15px; 
    font-size: 16px; 
    color: var(--text-grey); 
    text-align: center; /* Centered text reads better in narrow blocks */
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================
   How To Use Cards
   ========================================== */
.htu-grid {
    display: grid;
    /* Auto-fit with 280px ensures it drops to 1 column on mobile, 2/3 on desktop */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.htu-card {
    background: var(--bg-light);
    padding: 30px 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.htu-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-hover-shadow);
    border-color: var(--green-border);
}

.htu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 65px;
    height: 65px;
    background: var(--icon-bg);
    border-radius: 50%;
    font-size: 28px;
    margin-bottom: 20px;
    transition: transform 0.3s ease;
}

.htu-card:hover .htu-icon { transform: scale(1.1); }
.htu-card h3 { font-size: 18px; margin-bottom: 12px; }
.htu-card p { font-size: 14px; color: var(--text-grey); }

/* ==========================================
   FAQ Section
   ========================================== */
.faq-container { 
    max-width: 1200px;
    margin: 0 auto;
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
}

.faq-item {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 18px 20px;
    transition: all 0.3s ease;
}

.faq-item:hover { border-color: var(--green-border); }

.faq-item summary {
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-dark);
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
    content: '+';
    font-size: 24px;
    font-weight: 300;
    color: var(--text-grey);
    transition: transform 0.3s ease;
}

.faq-item[open] summary::after {
    content: '−';
    transform: rotate(180deg);
    color: var(--green-border);
}

.faq-item p {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    color: var(--text-grey);
    font-size: 15px;
}

/* ==========================================
   Mobile Responsiveness (Media Queries)
   ========================================== */

/* Tablets & Small Desktops */
@media (max-width: 768px) {
    .main-title { font-size: 28px; }
    .tool-section { padding: 30px 0; }
    .solver-card { padding: 20px 15px; }
}

/* Mobile Phones */
@media (max-width: 480px) {
    .main-title { font-size: 24px; }
    .main-subtitle { font-size: 14px; margin-bottom: 20px; }
    
    .input-row { 
        gap: 6px; 
    }
    
    /* Shrinking letter boxes slightly so 5 boxes fit perfectly on tiny screens */
    .letter-box { 
        width: 42px; 
        height: 48px; 
        font-size: 20px;
        border-width: 1px;
    }
    
    .excluded-input {
        font-size: 16px;
        height: 45px;
    }

    .about-section h2, .how-to-use-section h2, .faq-section h2 {
        font-size: 24px;
    }
    
    .faq-item summary {
        font-size: 15px;
        line-height: 1.4;
    }
}