/**
 * BlogThree Mobile UI Styles
 * 
 * @package BlogThree
 */

/* Mobile Base Styles */
.blogthree-mobile {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.blogthree-mobile * {
    -webkit-user-select: none;
    user-select: none;
}

.blogthree-mobile input,
.blogthree-mobile textarea {
    -webkit-user-select: text;
    user-select: text;
}

/* Mobile Menu */
.blogthree-mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.blogthree-mobile-menu.active {
    pointer-events: auto;
    opacity: 1;
}

.mobile-menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s;
}

.mobile-menu-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 80%;
    max-width: 320px;
    height: 100%;
    background: #fff;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.blogthree-mobile-menu.active .mobile-menu-panel {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.mobile-menu-logo h2 {
    margin: 0;
    font-size: 24px;
    color: #7B3FF2;
}

.mobile-menu-close {
    background: none;
    border: none;
    padding: 10px;
    margin: -10px;
    cursor: pointer;
}

.mobile-menu-search {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.mobile-menu-search form {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 25px;
    padding: 8px 15px;
}

.mobile-menu-search input {
    flex: 1;
    border: none;
    background: none;
    font-size: 16px;
    padding: 0;
    margin-right: 10px;
}

.mobile-menu-search button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.mobile-menu-nav {
    padding: 20px 0;
}

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

.mobile-menu-list li {
    border-bottom: 1px solid #f0f0f0;
}

.mobile-menu-list a {
    display: block;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    font-size: 16px;
    transition: background 0.2s;
}

.mobile-menu-list a:active {
    background: #f5f5f5;
}

.mobile-menu-user {
    padding: 20px;
    border-top: 1px solid #eee;
}

.mobile-user-info {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.mobile-user-info img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-right: 15px;
}

.mobile-user-info h4 {
    margin: 0 0 5px 0;
    font-size: 18px;
}

.mobile-logout-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: #f5f5f5;
    border: none;
    border-radius: 8px;
    text-align: center;
    color: #666;
    text-decoration: none;
}

.mobile-menu-auth {
    padding: 20px;
    border-top: 1px solid #eee;
}

.mobile-auth-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
}

.mobile-auth-btn.primary {
    background: #7B3FF2;
    border-color: #7B3FF2;
    color: #fff;
}

/* Bottom Navigation */
.blogthree-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 999;
    transform: translateY(0);
    transition: transform 0.3s;
}

.blogthree-mobile.keyboard-open .blogthree-bottom-nav {
    transform: translateY(100%);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    text-decoration: none;
    position: relative;
    transition: color 0.2s;
}

.bottom-nav-item.active {
    color: #7B3FF2;
}

.bottom-nav-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: 2px;
    fill: currentColor;
}

.bottom-nav-item span {
    font-size: 10px;
    font-weight: 500;
}

.bottom-nav-item img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-bottom: 2px;
}

.notification-badge {
    position: absolute;
    top: 8px;
    right: calc(50% - 16px);
    background: #ff4444;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

.bottom-nav-create {
    background: #7B3FF2;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    margin: -28px 0;
    border: none;
    box-shadow: 0 4px 12px rgba(123, 63, 242, 0.3);
}

.bottom-nav-create svg {
    fill: #fff;
    margin: 0;
}

/* Create Menu */
.mobile-create-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
}

.mobile-create-menu.active {
    display: block;
}

.create-menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.create-menu-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    animation: slideUp 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.create-menu-content h3 {
    margin: 0 0 20px 0;
    text-align: center;
    font-size: 20px;
}

.create-menu-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.create-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
}

.create-icon {
    width: 64px;
    height: 64px;
    background: #f5f5f5;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.create-option:active .create-icon {
    transform: scale(0.95);
    background: #eee;
}

.create-icon svg {
    fill: #7B3FF2;
}

.create-option span {
    font-size: 14px;
    text-align: center;
}

.create-menu-close {
    display: block;
    width: 100%;
    padding: 15px;
    background: #f5f5f5;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
}

/* Pull to Refresh */
.pull-refresh-indicator {
    position: fixed;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: none;
    z-index: 9999;
    font-size: 12px;
    color: #666;
}

.pull-refresh-indicator.visible {
    transition: transform 0.2s, opacity 0.2s;
}

.pull-refresh-indicator.ready {
    background: #7B3FF2;
    color: #fff;
}

.pull-refresh-indicator.refreshing {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: translateX(-50%) rotate(360deg); }
}

/* Touch Feedback */
.touch-feedback {
    position: relative;
    overflow: hidden;
}

.touch-feedback::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.touch-feedback.touched::after {
    width: 100%;
    height: 100%;
}

/* Mobile Toast */
.mobile-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    z-index: 9999;
    transition: transform 0.3s;
}

.mobile-toast.show {
    transform: translateX(-50%) translateY(0);
}

.mobile-toast.success {
    background: #4caf50;
}

.mobile-toast.warning {
    background: #ff9800;
}

.mobile-toast.error {
    background: #f44336;
}

/* Heart Animation */
.heart-animation {
    position: fixed;
    font-size: 100px;
    color: #ff4444;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
}

.heart-animation.animate {
    animation: heartPulse 1s ease-out;
}

@keyframes heartPulse {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

/* Mobile Optimized Cards */
.post-card.mobile-optimized {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.post-card.mobile-optimized .post-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.post-card.mobile-optimized .post-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.post-card.mobile-optimized .post-content {
    padding: 15px;
}

.post-card.mobile-optimized .post-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    line-height: 1.3;
    color: #333;
}

.post-card.mobile-optimized .post-excerpt {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.post-card.mobile-optimized .post-meta {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #999;
}

.post-card.mobile-optimized .author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 8px;
}

.post-card.mobile-optimized .author-name {
    margin-right: 8px;
}

/* Touch Slider */
.blogthree-touch-slider {
    position: relative;
    overflow: hidden;
    margin: 20px 0;
}

.blogthree-touch-slider .slider-wrapper {
    display: flex;
    transition: transform 0.3s ease-out;
}

.blogthree-touch-slider .slider-item {
    flex: 0 0 auto;
    width: 100%;
}

.slider-pagination {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.slider-pagination .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ddd;
    margin: 0 4px;
    transition: background 0.3s;
}

.slider-pagination .dot.active {
    background: #7B3FF2;
}

/* Infinite Scroll Loader */
.infinite-scroll-loader {
    text-align: center;
    padding: 20px;
}

.infinite-scroll-loader::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #7B3FF2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* iOS Specific */
.ios-device .blogthree-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(56px + env(safe-area-inset-bottom));
}

.ios-device .mobile-menu-panel {
    padding-top: env(safe-area-inset-top);
}

.ios-device .create-menu-content {
    padding-bottom: env(safe-area-inset-bottom);
}

/* Landscape Mode */
@media (orientation: landscape) {
    .blogthree-mobile.landscape .blogthree-bottom-nav {
        height: 48px;
    }
    
    .blogthree-mobile.landscape .bottom-nav-item span {
        display: none;
    }
    
    .blogthree-mobile.landscape .bottom-nav-create {
        width: 48px;
        height: 48px;
        margin: -24px 0;
    }
}

/* Tablet Adjustments */
@media (min-width: 768px) {
    .mobile-menu-panel {
        max-width: 400px;
    }
    
    .create-menu-options {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .post-card.mobile-optimized {
        display: grid;
        grid-template-columns: 200px 1fr;
    }
    
    .post-card.mobile-optimized .post-thumbnail {
        height: 100%;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .mobile-menu-panel,
    .blogthree-bottom-nav,
    .create-menu-content,
    .post-card.mobile-optimized {
        background: #1a1a1a;
        color: #fff;
    }
    
    .mobile-menu-header,
    .mobile-menu-search,
    .mobile-menu-list li,
    .mobile-menu-user,
    .mobile-menu-auth,
    .blogthree-bottom-nav {
        border-color: #333;
    }
    
    .mobile-menu-list a {
        color: #fff;
    }
    
    .mobile-menu-search form {
        background: #333;
    }
    
    .mobile-menu-search input {
        color: #fff;
    }
    
    .bottom-nav-item {
        color: #aaa;
    }
    
    .bottom-nav-item.active {
        color: #9b6dff;
    }
    
    .create-icon {
        background: #333;
    }
    
    .mobile-toast {
        background: #fff;
        color: #333;
    }
}