/*
 Theme Name:   APKPrime
 Theme URI:    https://apkprime.org/
 Description:  APKPrime - Platform Feature for Download Buttons
 Author:       APKPrime
 Author URI:   https://apkprime.org/
 Template:     appyn
 Version:      1.0.0
 Text Domain:  appyn-child
*/

/* ========================================
   ADMIN: Platform Dropdown in Metabox
   ======================================== */

.appyn-platform-cell {
    position: relative;
    vertical-align: middle !important;
    width: 1%;
    white-space: nowrap;
}

.appyn-platform-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: #f0f0f1;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #2c3338;
    white-space: nowrap;
    transition: all 0.2s;
}

.appyn-platform-dropdown-btn:hover {
    background: #e0e0e1;
    border-color: #2271b1;
}

.appyn-platform-dropdown-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 16px;
    transition: transform 0.2s;
}

.appyn-platform-dropdown-btn.open .dashicons {
    transform: rotate(180deg);
}

.appyn-platform-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 9999;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    min-width: 180px;
    margin-top: 4px;
}

.appyn-platform-dropdown.show {
    display: block;
}

.appyn-platform-dropdown label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    cursor: pointer;
    font-size: 13px;
    color: #2c3338;
    transition: background 0.15s;
    white-space: nowrap;
}

.appyn-platform-dropdown label:hover {
    background: #f0f0f1;
}

.appyn-platform-dropdown label input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
    accent-color: #2271b1;
}

.appyn-platform-dropdown label .appyn-platform-icon {
    display: inline-flex;
    align-items: center;
    width: 20px;
    height: 20px;
}

.appyn-platform-dropdown label .appyn-platform-icon svg {
    width: 18px;
    height: 18px;
    fill: #50575e;
}

.appyn-platform-badges {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 3px;
    margin-left: 5px;
    vertical-align: middle;
}

.appyn-platform-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e7f0f9;
    border: 1px solid #b8daff;
    border-radius: 3px;
    padding: 3px;
}

.appyn-platform-badge svg {
    width: 16px;
    height: 16px;
    fill: #135e96;
}

/* ========================================
   FRONTEND: Platform Icons INSIDE Download Button
   Mirror of .buttond i (left icon) styling
   
   Parent CSS reference:
   .buttond       → padding: 8px 5px 8px 38px; position: relative; overflow: hidden;
   .dapk_b        → padding-left: 48px; padding-right: 15px;
   .buttond i     → position:absolute; left:0; top:0; height:100%; width:33px;
                     padding:0 9px; background:rgba(0,0,0,.1);
                     border-right:1px solid rgba(0,0,0,.02);
   Gap left side  = 48px(pad-left) - 33px(icon-width) = 15px
   ======================================== */

/* Make list items block so buttons stack vertically */
#list-downloadlinks li {
    display: block !important;
}

/* Make button flex (block-level) so icons flow naturally inside */
#list-downloadlinks li a.buttond.downloadAPK.dapk_b {
    display: flex !important;
    align-items: stretch;
    width: 100% !important;
}

/* Remove right padding when platform icons present, icons take over that edge */
#list-downloadlinks li a.buttond.downloadAPK.dapk_b.has-platform-icons {
    padding-right: 0;
}

/* Wrapper for text to center it taking all remaining free flex space */
.appyn-dl-text {
    flex-grow: 1;
    text-align: center;
    align-self: center;
}

/*
 * Platform icons container — mirrors .buttond i on the right side.
 * Uses negative margins to bleed to the button edge (counteracting button padding),
 * so it auto-sizes regardless of number of icons (1-4).
 *
 * margin-left: 15px  → same 15px gap as left icon (48px pad - 33px icon = 15px)
 * margin-top/bottom: -8px → stretches full height (button padding-top/bottom = 8px)
 * border-radius right → matches button's 3px border-radius
 */
.appyn-dl-platform-icons {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 0, 0, .1);
    padding: 0 9px;
    border-left: 1px solid rgba(0, 0, 0, .02);
    margin: -8px 0 -8px auto;
    border-radius: 0 3px 3px 0;
}

.appyn-dl-platform-icons .appyn-dl-picon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.appyn-dl-platform-icons .appyn-dl-picon svg {
    width: 18px;
    height: 18px;
    fill: #ffffff;
    opacity: 0.9;
}

/* ========================================
   FRONTEND: Text Row Heading
   ======================================== */
#list-downloadlinks li.appyn-text-row {
    margin-top: 16px !important;
    margin-bottom: 6px !important;
}

#list-downloadlinks li.appyn-text-row .appyn-text-row-inner {
    font-size: 15px;
    font-weight: bold;
    opacity: 0.8;
    padding-bottom: 4px;
    border-bottom: 1px dashed rgba(150, 150, 150, 0.3);
}