/* 
   style.css - Native Offline Styling 
   No external dependencies or fonts.
*/

:root {
    --bg-color: #F0FDF4;
    /* Mint Green */
    --primary-color: #047857;
    /* Emerald Green */
    --accent-color: #10B981;
    --text-color: #064e3b;
    --white: #ffffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    direction: rtl;
    /* Native Font Stack for Arabic */
    font-family: 'Amiri', 'Traditional Arabic', 'Sakkal Majalla', 'Microsoft Sans Serif', 'Arial', serif;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.wide-container {
    max-width: 95%;
    /* Use 95% of screen width for the table */
    margin: 0 auto;
    padding: 20px;
}

header {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 40px 0;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header h2 {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: normal;
}

/* Search Box Styles */
.search-section {
    background: var(--white);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 4, 0.05);
    margin-bottom: 30px;
}

.search-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#searchInput {
    flex: 1;
    padding: 15px;
    font-size: 1.1rem;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    outline: none;
    font-family: inherit;
}

#searchBtn {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0 30px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

#searchBtn:hover {
    background-color: var(--accent-color);
}

/* Counter Display */
.counter-display {
    text-align: center;
    font-weight: bold;
    color: var(--primary-color);
    font-size: 0.95rem;
}

#counterValue {
    font-size: 1.2rem;
    text-decoration: underline;
}

/* Validation Error Message */
.error-msg {
    color: #DC2626;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    margin-top: 10px;
    margin-bottom: 15px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}

.error-msg.show {
    opacity: 1;
}

/* Status Messages */
#statusMsg {
    text-align: center;
    margin: 20px 0;
    font-weight: bold;
    min-height: 24px;
}

/* Results Table */
.results-area {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    display: none;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 15px;
    border-bottom: 2px solid var(--accent-color);
}

td {
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
    text-align: center;
}

tbody tr:nth-child(even) {
    background-color: #E6FFFA;
    /* Zebra Stripping */
}

tbody tr:hover {
    background-color: #f1f5f9;
}

.result-text {
    font-size: 1.5rem;
    line-height: 3.2rem;
    /* Increased for better readability with Tashkeel */
    text-align: right;
    padding: 20px;
    color: #1a202c;
}

/* Highlight */
.highlight {
    background-color: #FFFF00;
    /* Neon Yellow */
    color: #000;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: bold;
}

footer {
    text-align: center;
    padding: 30px;
    color: #4a5568;
    margin-top: 40px;
    border-top: 1px solid #cbd5e0;
}

/* Controls Bar */
.controls-bar {
    display: none;
    justify-content: flex-start;
    align-items: center;
    background: var(--white);
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.controls-bar label {
    margin-left: 15px;
    font-weight: bold;
    color: var(--primary-color);
}

.controls-bar select {
    padding: 8px 15px;
    border-radius: 8px;
    border: 1.5px solid var(--primary-color);
    outline: none;
    font-family: inherit;
    color: var(--text-color);
    cursor: pointer;
    background: var(--white);
}

/* Pagination Area */
.pagination-area {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 30px;
    padding: 20px;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 10px 18px;
    border: 1.5px solid var(--primary-color);
    background-color: var(--white);
    color: var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
    min-width: 45px;
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--bg-color);
    transform: translateY(-2px);
}

.pagination-btn.active {
    background-color: var(--primary-color);
    color: var(--white);
    box-shadow: 0 4px 10px rgba(4, 120, 87, 0.3);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-ellipsis {
    color: #6b7280;
    font-weight: bold;
    padding: 0 5px;
}

@media (max-width: 600px) {

    .container,
    .wide-container {
        max-width: 100%;
        padding: 10px;
    }

    .search-section {
        padding: 15px;
    }

    .search-group {
        flex-direction: column;
    }

    #searchBtn {
        padding: 15px;
    }

    /* Transform Table to Cards on Mobile */
    .results-area table,
    .results-area thead,
    .results-area tbody,
    .results-area th,
    .results-area td,
    .results-area tr {
        display: block;
    }

    .results-area thead {
        display: none;
        /* Hide table headers */
    }

    .results-area tr {
        background: var(--white);
        margin-bottom: 20px;
        border-radius: 12px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
        border: 1px solid #e2e8f0;
        overflow: hidden;
        position: relative;
        padding: 15px;
    }

    /* Individual Cells in Card */
    .results-area td {
        border: none;
        padding: 5px 0;
        text-align: right;
    }

    /* ID Column as a small badge */
    .results-area td:nth-child(1) {
        position: absolute;
        top: 10px;
        left: 10px;
        background: #f7fafc;
        padding: 2px 8px;
        border-radius: 4px;
        font-size: 0.8rem;
        color: #718096;
    }

    /* Surah Name & Ayah Header */
    .results-area td:nth-child(3) {
        display: inline-block;
        font-size: 1.1rem;
        color: var(--primary-color);
        border-left: 2px solid #e2e8f0;
        padding-left: 10px;
        margin-left: 10px;
        font-weight: bold;
    }

    .results-area td:nth-child(2) {
        display: inline-block;
        font-size: 1.1rem;
        font-weight: bold;
    }

    .results-area td:nth-child(2)::before {
        content: "آية: ";
        font-weight: normal;
        font-size: 0.9rem;
        color: #718096;
    }

    /* Verse Body */
    .results-area .result-text {
        font-size: 1.3rem;
        line-height: 2.8rem;
        padding: 15px 0 0 0;
        margin-top: 10px;
        border-top: 1px dashed #edf2f7;
        width: 100%;
        text-align: justify;
        text-align-last: right;
    }

    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
    }

    .controls-bar label {
        margin-bottom: 10px;
        margin-left: 0;
        text-align: center;
    }

    .pagination-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
        min-width: 35px;
    }
}