/* Quran Page Specific Styles */

/* Search Section */
.search-section .input-group-text {
    background-color: var(--card-background);
    border-color: var(--border-color);
    border-width: 2px;
    border-radius: 0 12px 12px 0 !important;
}

.search-section .form-control {
    background-color: var(--card-background);
    border-color: var(--border-color);
    padding-right: 1rem;
    font-size: 1.1rem;
    border-width: 2px;
    border-radius: 12px 0 0 12px !important;
}

.search-section .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(76, 175, 80, 0.25);
}

/* Surah List Section */
.surah-section h5 {
    font-weight: 600;
    color: var(--text-color);
    font-size: 1.25rem;
}

.surah-section #surah-count {
    font-size: 0.9rem;
    font-weight: 500;
}

#surah-list .list-group-item {
    background-color: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    margin-bottom: 0.8rem;
    transition: all 0.3s ease;
    padding: 1.2rem 1.2rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

#surah-list .list-group-item:hover {
    background-color: rgba(76, 175, 80, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

#surah-list .list-group-item::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

#surah-list .list-group-item:hover::before {
    transform: scaleY(1);
}

.surah-number-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    min-width: 50px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.surah-number-circle:hover {
    transform: scale(1.05);
}

.surah-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.surah-details {
    font-size: 0.85rem;
    color: var(--text-light);
}

.surah-english-name {
    font-size: 0.8rem;
    color: var(--text-light);
    font-style: italic;
}

/* Touch Optimizations */
.touch-optimized {
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.touch-optimized:active,
.touch-active {
    background-color: rgba(76, 175, 80, 0.1) !important;
    transform: scale(0.98);
    transition: all 0.1s ease;
}

.touch-target {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.touch-selectable {
    user-select: text;
    -webkit-user-select: text;
    -webkit-touch-callout: default;
}

/* Surah Content Section (replaces modal) */
#surah-content-section {
    background-color: var(--card-background);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin-top: 1.2rem;
    animation: fadeIn 0.4s ease;
    border: 1px solid var(--border-color);
}

#surah-content-title {
    font-weight: 700;
    color: var(--text-color);
    font-size: 1.5rem;
    margin-bottom: 1.2rem;
    text-align: center;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid var(--primary-color);
}

#back-to-surah-list {
    border-radius: 10px;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    min-height: 44px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.3);
}

#back-to-surah-list:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

#back-to-surah-list:active {
    transform: translateY(0);
}

.surah-content-area {
    font-family: 'Amiri', serif;
    font-size: 1.8rem;
    line-height: 2.6;
    padding: 2rem; /* Increased padding */
    max-width: 800px; /* Added max-width */
    margin: 0.8rem auto; /* Centered and adjusted margin */
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background-color: var(--card-background); /* Changed to card-background for consistency */
    border-radius: 16px; /* Increased border-radius */
    background: linear-gradient(to bottom, var(--card-background) 0%, var(--background-color) 100%);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); /* Adjusted box-shadow for a more prominent page feel */
    border: 1px solid var(--border-color); /* Added border */
}

.ayah-container {
    padding: 0 1.2rem;
    max-width: 100%;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.ayah {
    margin-bottom: 2rem;
    text-align: justify;
    text-justify: inter-word;
    padding: 1.5rem 0.8rem;
    position: relative;
    font-size: 2.2rem; /* Further increased */
    line-height: 2.8; /* Adjusted */
    font-family: 'Amiri', serif;
    font-weight: 400;
    word-spacing: 0.1em;
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "liga" 1, "kern" 1;
    word-wrap: break-word;
    hyphens: auto;
    min-height: 44px;
    cursor: default;
    transition: none;
    border-bottom: 1px dashed var(--border-color-light);
    background: linear-gradient(to right, transparent 0%, rgba(76, 175, 80, 0.02) 50%, transparent 100%);
}

.ayah:first-child {
    text-align: center;
    font-size: 2.5rem; /* Larger for Bismillah */
    font-weight: 700; /* Bolder for Bismillah */
    margin-bottom: 3rem; /* More space after Bismillah */
    border-bottom: none; /* No border for Bismillah */
    background: none; /* No background gradient for Bismillah */
    padding-top: 0.8rem;
}



.ayah:last-child {
    border-bottom: none;
    margin-bottom: 0.8rem;
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 1200px) {
    .surah-content-area {
        font-size: 1.7rem;
        line-height: 2.5;
        padding: 2.5rem 1.5rem; /* Adjusted padding */
        max-width: 700px; /* Adjusted max-width */
    }
    
    .ayah {
        font-size: 1.7rem;
        line-height: 2.5;
        margin-bottom: 1.9rem;
        padding: 1.4rem 0.7rem;
    }
    
    #surah-content-title {
        font-size: 1.4rem;
    }
}

@media (max-width: 992px) {
    .surah-number-circle {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
        min-width: 48px;
    }
    
    .surah-name {
        font-size: 1.05rem;
    }
    
    .surah-content-area {
        font-size: 1.6rem;
        padding: 2rem 1.2rem; /* Adjusted padding */
        max-width: 600px; /* Adjusted max-width */
        line-height: 2.4;
    }
    
    .ayah {
        font-size: 1.6rem;
        line-height: 2.4;
        margin-bottom: 1.8rem;
        padding: 1.3rem 0.6rem;
    }
    
    .search-section .form-control {
        font-size: 1.05rem;
        padding: 0.85rem 1.1rem;
    }
    
    #surah-content-title {
        font-size: 1.35rem;
    }
    
    #surah-content-section {
        padding: 1.3rem;
    }
}

@media (max-width: 768px) {
    .app-header {
        padding: 0.5rem 0;
    }
    
    .app-header h1 {
        font-size: 1.2rem;
    }
    
    .search-section {
        margin-bottom: 1rem;
    }
    
    .surah-number-circle {
        width: 45px;
        height: 45px;
        font-size: 1rem;
        min-width: 45px;
    }
    
    .surah-name {
        font-size: 1rem;
    }
    
    #surah-list .list-group-item {
        padding: 1rem 1rem;
        margin-bottom: 0.6rem;
    }
    
    .surah-content-area {
        font-size: 1.5rem;
        padding: 1.5rem 1rem; /* Adjusted padding */
        max-width: 500px; /* Adjusted max-width */
        line-height: 2.3;
    }
    
    .ayah {
        font-size: 1.5rem;
        line-height: 2.3;
        margin-bottom: 1.6rem;
        padding: 1.2rem 0.5rem;
    }
    
    .search-section .form-control {
        font-size: 1rem;
        padding: 0.75rem 0.9rem;
    }
    
    #surah-content-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    #surah-content-section {
        padding: 1.2rem;
    }
    
    #back-to-surah-list {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        min-height: 42px;
    }
}

@media (max-width: 576px) {
    .app-header h1 {
        font-size: 1.1rem;
    }
    
    .surah-number-circle {
        width: 42px;
        height: 42px;
        font-size: 0.95rem;
        min-width: 42px;
    }
    
    .surah-name {
        font-size: 0.95rem;
    }
    
    .surah-details {
        font-size: 0.8rem;
    }
    
    .surah-english-name {
        font-size: 0.75rem;
    }
    
    #surah-list .list-group-item {
        padding: 0.9rem 0.9rem;
        margin-bottom: 0.5rem;
        border-radius: 12px;
    }
    
    .surah-content-area {
        font-size: 1.4rem;
        padding: 1rem 0.8rem; /* Adjusted padding */
        max-width: 100%; /* Full width on mobile */
        line-height: 2.2;
        border-radius: 12px;
        margin: 0.5rem 0; /* Reduced margin on mobile */
        box-shadow: none; /* Remove shadow on mobile for better readability */
        border: none; /* Remove border on mobile */
        background: var(--card-background); /* Solid background on mobile */
    }
    
    .ayah {
        font-size: 1.4rem;
        line-height: 2.2;
        margin-bottom: 1.5rem;
        padding: 1.1rem 0.4rem;
        border-bottom: 1px solid var(--border-color); /* Solid border instead of dashed */
    }
    
    .search-section .form-control {
        font-size: 0.95rem;
        padding: 0.65rem 0.8rem;
    }
    
    #surah-content-section {
        padding: 1rem;
        border-radius: 12px;
    }
    
    #surah-content-title {
        font-size: 1.2rem;
        margin-bottom: 0.8rem;
    }
    
    #back-to-surah-list {
        padding: 0.45rem 0.9rem;
        font-size: 0.85rem;
        min-height: 40px;
        border-radius: 8px;
        width: 100%; /* Full width button on mobile */
        margin-bottom: 1rem;
    }
    
    .ayah-container {
        padding: 0 0.7rem;
    }
}

@media (max-width: 480px) {
    .app-header h1 {
        font-size: 1.05rem;
    }
    
    .surah-number-circle {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
        min-width: 40px;
    }
    
    .surah-name {
        font-size: 0.92rem;
    }
    
    .surah-details {
        font-size: 0.78rem;
    }
    
    .surah-english-name {
        font-size: 0.72rem;
    }
    
    #surah-list .list-group-item {
        padding: 0.85rem 0.85rem;
        margin-bottom: 0.45rem;
    }
    
    .surah-content-area {
        font-size: 1.35rem;
        padding: 0.8rem 0.6rem; /* Adjusted padding */
        line-height: 2.1;
    }
    
    .ayah {
        font-size: 1.35rem;
        line-height: 2.1;
        margin-bottom: 1.4rem;
        padding: 1rem 0.35rem;
    }
    
    .search-section .form-control {
        font-size: 0.9rem;
        padding: 0.6rem 0.75rem;
    }
    
    #surah-content-section {
        padding: 0.9rem;
        margin-top: 1rem;
    }
    
    #surah-content-title {
        font-size: 1.15rem;
        margin-bottom: 0.7rem;
    }
    
    #back-to-surah-list {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 400px) {
    .app-header h1 {
        font-size: 1rem;
    }
    
    .surah-number-circle {
        width: 38px;
        height: 38px;
        font-size: 0.85rem;
        min-width: 38px;
    }
    
    .surah-name {
        font-size: 0.9rem;
    }
    
    .surah-details {
        font-size: 0.75rem;
    }
    
    .surah-english-name {
        font-size: 0.7rem;
    }
    
    #surah-list .list-group-item {
        padding: 0.8rem 0.8rem;
        margin-bottom: 0.4rem;
        border-radius: 10px;
    }
    
    .surah-content-area {
        font-size: 1.3rem;
        padding: 0.7rem 0.5rem; /* Adjusted padding */
        line-height: 2.0;
    }
    
    .ayah {
        font-size: 1.3rem;
        line-height: 2.0;
        margin-bottom: 1.3rem;
        padding: 0.9rem 0.3rem;
    }
    
    .search-section .form-control {
        font-size: 0.88rem;
        padding: 0.55rem 0.7rem;
    }
    
    #surah-content-section {
        padding: 0.8rem;
    }
    
    #surah-content-title {
        font-size: 1.1rem;
        margin-bottom: 0.6rem;
    }
    
    #back-to-surah-list {
        padding: 0.35rem 0.7rem;
        font-size: 0.75rem;
        min-height: 38px;
    }
    
    .ayah-container {
        padding: 0 0.6rem;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .surah-number-circle {
        width: 36px;
        height: 36px;
        font-size: 0.82rem;
        min-width: 36px;
    }
    
    .surah-name {
        font-size: 0.88rem;
    }
    
    .surah-details {
        font-size: 0.72rem;
    }
    
    .surah-english-name {
        font-size: 0.68rem;
    }
    
    #surah-list .list-group-item {
        padding: 0.75rem 0.75rem;
        margin-bottom: 0.35rem;
    }
    
    .surah-content-area {
        font-size: 1.25rem;
        padding: 0.6rem 0.4rem; /* Adjusted padding */
        line-height: 1.9;
    }
    
    .ayah {
        font-size: 1.25rem;
        line-height: 1.9;
        margin-bottom: 1.2rem;
        padding: 0.85rem 0.25rem;
    }
    
    .ayah-container {
        padding: 0.5rem 0;
    }
    
    #surah-content-section {
        padding: 0.7rem;
    }
    
    #surah-content-title {
        font-size: 1.05rem;
        margin-bottom: 0.5rem;
    }
    
    #back-to-surah-list {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }
}

/* Extra small devices */
@media (max-width: 320px) {
    .surah-number-circle {
        width: 34px;
        height: 34px;
        font-size: 0.8rem;
        min-width: 34px;
    }
    
    .surah-name {
        font-size: 0.85rem;
    }
    
    .surah-details {
        font-size: 0.7rem;
    }
    
    .surah-english-name {
        font-size: 0.65rem;
    }
    
    #surah-list .list-group-item {
        padding: 0.7rem 0.7rem;
        margin-bottom: 0.3rem;
        border-radius: 8px;
    }
    
    .surah-content-area {
        font-size: 1.2rem;
        padding: 0.5rem 0.3rem; /* Adjusted padding */
        line-height: 1.8;
    }
    
    .ayah {
        font-size: 1.2rem;
        line-height: 1.8;
        margin-bottom: 1.1rem;
        padding: 0.8rem 0.2rem;
    }
    
    .ayah-container {
        padding: 0.4rem 0;
    }
    
    #surah-content-section {
        padding: 0.6rem;
        border-radius: 8px;
    }
    
    #surah-content-title {
        font-size: 1rem;
        margin-bottom: 0.4rem;
    }
    
    #back-to-surah-list {
        padding: 0.25rem 0.5rem;
        font-size: 0.65rem;
        min-height: 36px;
    }
}

/* Enhanced touch interactions for mobile */
@media (hover: none) and (pointer: coarse) {
    #surah-list .list-group-item {
        transition: none;
    }
    
    #surah-list .list-group-item:hover {
        background-color: var(--card-background);
        transform: none;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
        border-color: var(--border-color);
    }
    
    [data-theme="dark"] #surah-list .list-group-item:hover {
        background-color: #2c3e50;
        border-color: #34495e;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    }
    
    .surah-number-circle:hover {
        transform: none;
    }
    
    /* Touch targets for mobile */
    .ayah {
        padding: 1.8rem 0.9rem;
        margin-bottom: 2.2rem;
        font-size: 1.6rem;
        line-height: 2.3;
        min-height: 50px;
    }
    
    .ayah-number-badge {
        min-height: 30px;
        min-width: 30px;
        font-size: 0.8rem;
        width: 30px;
        height: 30px;
        top: -12px;
    }
    
    .surah-content-area {
        font-size: 1.6rem;
        padding: 1.8rem 1.2rem;
        line-height: 2.3;
    }
    
    #back-to-surah-list {
        min-height: 46px;
        padding: 0.6rem 1.1rem;
        font-size: 0.95rem;
        border-radius: 10px;
        width: 100%;
        margin-bottom: 1rem;
    }
    
    #surah-content-title {
        font-size: 1.4rem;
        margin-bottom: 1.2rem;
    }
    
    #surah-content-section {
        padding: 1.5rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.ayah {
    animation: slideInUp 0.3s ease;
}

/* Scrollbar styling */
.surah-content-area::-webkit-scrollbar {
    width: 6px;
}

.surah-content-area::-webkit-scrollbar-track {
    background: var(--background-color);
    border-radius: 3px;
}

.surah-content-area::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.surah-content-area::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

[data-theme="dark"] .surah-content-area::-webkit-scrollbar-track {
    background: #2c2c2c;
}

[data-theme="dark"] .surah-content-area::-webkit-scrollbar-thumb {
    background: var(--primary-color);
}

[data-theme="dark"] .surah-content-area::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Focus states for accessibility */
.ayah:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
    border-radius: 6px;
}