/* Mobile-First Responsive Styles for SEO.GRZ.MEDIA */

/* Mobile Navigation Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s;
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 999;
    padding: 0 20px 0 80px;
    align-items: center;
    justify-content: space-between;
}

.mobile-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Overlay for mobile menu */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile Breakpoints */
@media (max-width: 768px) {
    /* Show mobile elements */
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-header {
        display: flex;
    }
    
    /* Sidebar adjustments */
    .sidebar {
        position: fixed;
        left: -280px;
        width: 280px;
        transition: left 0.3s ease;
        z-index: 1000;
        height: 100vh;
        overflow-y: auto;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    /* Main content adjustments */
    .main-content,
    .article-main-content,
    .articles-main,
    .keywords-main,
    .settings-main {
        margin-left: 0 !important;
        padding: 90px 15px 20px 15px !important;
    }
    
    /* Dashboard specific */
    .dashboard-container {
        padding-top: 70px;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
        margin-top: 20px;
    }
    
    .header-left h1 {
        font-size: 1.5rem;
    }
    
    .header-right {
        width: 100%;
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .btn-primary {
        flex: 1;
        min-width: 140px;
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .date-range {
        flex: 1;
        min-width: 140px;
        justify-content: center;
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 0 15px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    /* Charts */
    .charts-row {
        flex-direction: column;
        padding: 0 15px;
        gap: 20px;
    }
    
    .chart-card {
        width: 100%;
        min-height: 300px;
    }
    
    .articles-list {
        max-height: none;
    }
    
    /* Articles */
    .article-item {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
    
    .article-stats {
        width: 100%;
        justify-content: space-between;
    }
    
    /* Quick Actions */
    .quick-actions {
        padding: 0 15px;
        gap: 10px;
    }
    
    .action-btn {
        flex: 1 1 calc(50% - 5px);
        min-width: 140px;
    }
    
    /* Keywords */
    .keywords-container {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .keyword-item {
        width: 100%;
    }
    
    /* Tables */
    .articles-table {
        overflow-x: auto;
    }
    
    .articles-table table {
        min-width: 600px;
    }
    
    /* Forms */
    .article-form-card {
        padding: 20px 15px;
        margin: 20px 10px;
    }
    
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="url"],
    select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Login Page Mobile */
    .login-container {
        margin: 20px;
        padding: 30px 20px;
    }
    
    /* Settings */
    .settings-grid {
        padding: 0 10px;
    }
    
    .settings-card {
        padding: 20px 15px;
    }
    
    /* Keywords Page */
    .keywords-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .keyword-cloud {
        padding: 20px 15px;
    }
    
    .keyword-tag {
        margin: 4px;
        padding: 6px 12px;
        font-size: 0.875rem;
    }
    
    .keyword-tag.size-xl {
        font-size: 1.2rem;
        padding: 8px 16px;
    }
    
    .keyword-tag.size-lg {
        font-size: 1rem;
        padding: 7px 14px;
    }
    
    /* All Articles Page */
    .articles-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .search-bar {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .search-input {
        width: 100%;
        font-size: 16px;
    }
    
    .filter-select {
        width: 100%;
        font-size: 16px;
    }
    
    /* Buttons */
    .btn-icon {
        padding: 8px;
        min-width: 36px;
        min-height: 36px;
    }
    
    /* Modals and Overlays */
    .modal {
        width: 90%;
        margin: 5%;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    /* Language Selection */
    .language-checkboxes {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .language-checkbox {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    /* WordPress Section */
    .wordpress-section {
        padding: 15px;
        margin: 15px 0;
    }
    
    .wp-send-btn {
        width: 100%;
        padding: 15px;
        font-size: 1rem;
    }
    
    /* Output Section */
    .output-section {
        padding: 15px;
    }
    
    .output-item {
        margin-bottom: 20px;
    }
    
    .copyable-field {
        font-size: 14px;
        padding: 12px;
    }
    
    .copy-btn {
        width: 100%;
        margin-top: 10px;
    }
    
    /* SEO Rating */
    .seo-rating-container {
        padding: 20px 10px;
    }
    
    .rating-circle {
        transform: scale(0.8);
    }
    
    /* Footer adjustments */
    .sidebar-footer {
        position: relative;
        bottom: auto;
        padding: 15px;
    }
    
    .user-info {
        font-size: 0.875rem;
    }
}

/* Smaller Mobile Devices */
@media (max-width: 480px) {
    /* Even more compact for small phones */
    .mobile-header h1 {
        font-size: 1.1rem;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 1.75rem;
    }
    
    .btn-primary {
        font-size: 0.85rem;
        padding: 8px 12px;
    }
    
    .action-btn {
        flex: 1 1 100%;
    }
    
    .keyword-tag {
        font-size: 0.75rem;
        padding: 5px 10px;
    }
    
    .article-form-card {
        padding: 15px 10px;
    }
    
    /* Stack all form elements */
    .language-checkboxes {
        grid-template-columns: 1fr;
    }
    
    /* Reduce chart heights on small screens */
    #seoTrendChart,
    #languageChart,
    #keywordTrendChart {
        max-height: 200px;
    }
}

/* Landscape Mode Adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-header {
        height: 60px;
    }
    
    .mobile-menu-toggle {
        width: 45px;
        height: 45px;
        top: 7.5px;
    }
    
    .main-content,
    .article-main-content,
    .articles-main,
    .keywords-main,
    .settings-main {
        padding-top: 70px !important;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .action-btn {
        flex: 1 1 calc(25% - 7.5px);
    }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    button, 
    .btn-primary,
    .btn-secondary,
    .btn-icon,
    .action-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-item {
        padding: 15px 20px;
    }
    
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
    }
    
    /* Remove hover effects on touch devices */
    .article-item:hover,
    .keyword-tag:hover,
    .action-btn:hover {
        transform: none;
    }
}

/* Smooth scrolling for mobile */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Prevent horizontal scroll */
body {
    overflow-x: hidden;
}

/* Fix for iOS Safari */
.sidebar {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Improve form usability on mobile */
input, textarea, select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 8px;
}

/* Better touch feedback */
button:active,
.btn-primary:active,
.btn-icon:active {
    opacity: 0.8;
}

/* Loading states for mobile */
.mobile-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
}

/* Pull to refresh hint */
.pull-to-refresh {
    position: absolute;
    top: -50px;
    left: 0;
    right: 0;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667eea;
    font-size: 0.875rem;
}