/**
 * Custom CSS – Enhancements
 * @package GetCloud_Tech
 */

/* Sticky nav */
.main-nav.sticky-active {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
    animation: slideDown .3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

/* Code copy */
.code-wrapper {
    position: relative;
}

.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255, 255, 255, .2);
    color: #ccc;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 3px;
    cursor: pointer;
    transition: all var(--transition);
}

.code-copy-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* Comment form */
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 14px;
    font-family: var(--font);
    transition: border-color var(--transition);
    margin-bottom: 14px;
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.comment-form .submit {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition);
}

.comment-form .submit:hover {
    background: var(--accent-dark);
}

/* Search page form */
.search-page-form {
    display: flex;
    max-width: 480px;
    margin: 0 auto 30px;
}

.search-page-form input[type="search"] {
    flex: 1;
    min-width: 0;
    border: 2px solid var(--border);
    border-right: none;
    padding: 12px 18px;
    font-size: 14px;
    border-radius: var(--radius) 0 0 var(--radius);
    outline: none;
    font-family: var(--font);
    box-sizing: border-box;
}

.search-page-form input[type="search"]:focus {
    border-color: var(--accent);
}

.search-page-form button {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 12px 22px;
    font-size: 16px;
    border-radius: 0 var(--radius) var(--radius) 0;
    cursor: pointer;
    flex-shrink: 0;
}

/* Responsive mobile */
@media (max-width: 767px) {

    /* Prevent horizontal scroll globally */
    html,
    body {
        overflow-x: hidden;
        max-width: 100vw;
    }

    /* Container safety */
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Fix Featured Post Overflow (Stack Vertical) */
    .hpost-featured {
        flex-direction: column;
        gap: 12px;
    }

    .hpost-featured .hpost-thumb {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
    }

    .hpost-featured .hpost-body h3 {
        font-size: 1.25rem;
    }

    /* Sidebar Adjustments */
    .follow-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        padding: 12px;
    }

    .sidebar-tabs .tab-btn {
        font-size: 11px;
        padding: 8px 4px;
    }

    .hpost .hpost-thumb {
        width: 100px;
        height: 72px;
    }

    /* Search Form Overflow Fix */
    .search-page-form {
        max-width: 100%;
    }

    .search-page-form input[type="search"] {
        flex: 1;
        min-width: 0;
        width: 100%;
        padding: 10px 14px;
    }

    /* Modal Padding */
    .modal-body {
        padding: 16px !important;
    }

    /* Ad container overflow */
    .ad-container {
        max-width: 100%;
        overflow: hidden;
    }

    /* Breaking bar overflow */
    .breaking-bar {
        max-width: 100%;
    }

    .breaking-text {
        max-width: calc(100% - 160px);
    }

    /* Images safety */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Tables safety */
    table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
    }
}

/* ==========================================================================
   Global Mobile Search & Input Fix (360px and below)
   ========================================================================== */
@media (max-width: 480px) {

    /* Force all flex-based search forms to stay within viewport */
    .search-form,
    .search-page-form,
    .search-widget .search-form,
    .no-posts .search-form,
    .input-group,
    .search-modal-group {
        max-width: 100%;
        width: 100%;
    }

    .search-form input[type="search"],
    .search-page-form input[type="search"],
    .search-widget .search-form input[type="search"],
    .no-posts .search-form input[type="search"],
    .input-group .form-control,
    .search-modal-group .form-control {
        min-width: 0 !important;
        width: 0;
        flex: 1 1 0%;
        box-sizing: border-box;
        font-size: 13px;
        padding: 8px 10px;
    }

    .search-form button,
    .search-page-form button,
    .search-widget .search-form button,
    .no-posts .search-form button,
    .input-group .btn,
    .search-modal-group .btn {
        flex-shrink: 0;
        padding: 8px 12px;
        font-size: 13px;
    }

    /* Search modal fill mobile */
    #searchModal .modal-dialog {
        margin: 10px;
        max-width: calc(100vw - 20px);
    }

    #searchModal .modal-body {
        padding: 14px !important;
    }

    /* Section header text fix */
    .section-header {
        flex-wrap: wrap;
        gap: 6px;
    }

    .section-label {
        font-size: 11px;
        padding: 4px 10px;
    }

    .section-view-all {
        font-size: 12px;
    }
}