/*
 * Attila WP Additional Styles
 * Progress bar, search overlay, comments, pagination, accessibility, dark mode, mobile
 */

/* ============================================
   Reading Progress Bar
   ============================================ */
.attila-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: #3eb0ef;
    z-index: 99999;
    transition: width 0.1s ease-out;
    pointer-events: none;
}

/* ============================================
   Search Overlay
   ============================================ */
.attila-search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.attila-search-overlay.active {
    display: flex;
}

.attila-search-overlay-inner {
    width: 90%;
    max-width: 600px;
    position: relative;
}

.attila-search-close {
    position: absolute;
    top: -50px;
    right: 0;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.attila-search-close:hover,
.attila-search-close:focus-visible {
    opacity: 1;
}

.attila-search-form {
    width: 100%;
}

.attila-search-field {
    width: 100%;
    padding: 16px 20px;
    font-size: 22px;
    border: none;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: #fff;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 0;
}

.attila-search-field::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.attila-search-field:focus {
    border-bottom-color: #fff;
}

/* ============================================
   Comments Area
   ============================================ */
.comments-area {
    max-width: 720px;
    margin: 0 auto;
    padding: 2em 0;
}

.comments-title {
    font-size: 1.4em;
    margin-bottom: 1em;
}

.comment-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.comment-list li {
    padding: 1em 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.comment-form label {
    display: block;
    margin-bottom: 0.3em;
    font-weight: 600;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1em;
    margin-bottom: 1em;
    transition: border-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.comment-form input:focus,
.comment-form textarea:focus {
    border-color: #3eb0ef;
    outline: none;
}

.comment-form .form-submit input[type="submit"] {
    background: #3eb0ef;
    color: #fff;
    border: none;
    padding: 10px 24px;
    font-size: 1em;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.comment-form .form-submit input[type="submit"]:hover {
    opacity: 0.85;
}

.no-comments {
    font-style: italic;
    color: #999;
}

/* ============================================
   WordPress Pagination (custom Attila-style)
   ============================================ */
.nav-links {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 2em 0;
}

.nav-links .page-numbers {
    padding: 6px 12px;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.2s ease, color 0.2s ease;
}

.nav-links .page-numbers.current {
    background: #3eb0ef;
    color: #fff;
}

/* ============================================
   Accessibility: Screen Reader Text
   ============================================ */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

.screen-reader-text:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    clip-path: none;
    color: #21759b;
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* ============================================
   Focus Visible – keyboard navigation
   ============================================ */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid #3eb0ef;
    outline-offset: 2px;
}

/* ============================================
   Mobile Touch Improvements
   ============================================ */
.nav-menu,
.nav-search,
.nav-close,
.attila-search-close,
.pagination a,
.post-nav a {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* ============================================
   Smooth Scrolling (respects prefers-reduced-motion)
   ============================================ */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* ============================================
   Dark Mode: WP-specific elements
   ============================================ */
.theme-dark .comments-area,
.theme-dark .comment-list li {
    border-color: rgba(255, 255, 255, 0.1);
}

.theme-dark .comment-form input[type="text"],
.theme-dark .comment-form input[type="email"],
.theme-dark .comment-form input[type="url"],
.theme-dark .comment-form textarea {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: #fff;
}

@media (prefers-color-scheme: dark) {

    html:not(.theme-light) .comments-area,
    html:not(.theme-light) .comment-list li {
        border-color: rgba(255, 255, 255, 0.1);
    }

    html:not(.theme-light) .comment-form input[type="text"],
    html:not(.theme-light) .comment-form input[type="email"],
    html:not(.theme-light) .comment-form input[type="url"],
    html:not(.theme-light) .comment-form textarea {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.15);
        color: #fff;
    }
}

/* ============================================
   Mobile Responsive Tweaks
   ============================================ */
@media only screen and (max-width: 480px) {
    .attila-search-field {
        font-size: 18px;
        padding: 12px 16px;
    }

    .attila-search-close {
        font-size: 28px;
        top: -40px;
    }

    .comment-form input[type="text"],
    .comment-form input[type="email"],
    .comment-form input[type="url"],
    .comment-form textarea {
        font-size: 16px;
        /* Prevents iOS zoom on focus */
    }
}

/* ============================================
   Safe Areas (notch devices / iOS)
   ============================================ */
@supports (padding: env(safe-area-inset-top)) {
    .nav-header {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    .nav-footer {
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}