/* ========== ADMIN PANEL STYLES ========== */

.admin-container {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 20px;
}

/* Admin Header */
.admin-header {
    margin-bottom: 30px;
}

.admin-header h1 {
    font-size: 32px;
    color: #1a1a1a;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-header h1 i {
    color: var(--secondary-color);
}

.admin-header p {
    color: #666;
    font-size: 16px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.stat-info p {
    font-size: 14px;
    color: #666;
    margin: 5px 0 0 0;
}

/* Toolbar */
.admin-toolbar {
    background: white;
    padding: 20px;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
}

.tab-btn {
    padding: 10px 20px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.tab-btn.active {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

/* Search Input */
.search-input {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    width: 250px;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.btn-refresh {
    padding: 10px 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-refresh:hover {
    background: #e0a800;
}

/* Bulk Actions Bar */
.bulk-actions {
    background: #fff3cd;
    padding: 15px 20px;
    border: 2px solid #ffc107;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bulk-actions span {
    font-weight: 600;
    color: #856404;
}

.btn-bulk {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.3s;
    margin-left: 10px;
}

.btn-bulk:hover {
    opacity: 0.9;
}

.btn-bulk.btn-publish {
    background: #51cf66;
    color: white;
}

.btn-bulk.btn-delete {
    background: #e74c3c;
    color: white;
}

/* Table Container */
.table-container {
    background: white;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
    /* 🔧 FIX: Allow horizontal scroll on mobile */
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on iOS */
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
    /* 🔧 FIX: Ensure minimum width for scroll trigger */
}

.admin-table thead {
    background: #f8f9fa;
}

.admin-table th {
    padding: 15px;
    text-align: left;
    font-weight: 700;
    color: #1a1a1a;
    border-bottom: 2px solid #e0e0e0;
    font-size: 14px;
    white-space: nowrap;
    /* Prevent header wrap */
}

.admin-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.admin-table tbody tr:hover {
    background: #f8f9fa;
}

.admin-table td {
    padding: 15px;
    color: #333;
    font-size: 14px;
}

/* Status Badges */
.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    white-space: nowrap;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-published {
    background: #d1f2eb;
    color: #0f5132;
}

/* Action Buttons */
.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.3s;
    margin-right: 5px;
    color: white;
    white-space: nowrap;
    /* Prevent button text wrap */
}

.action-btn:hover {
    opacity: 0.8;
}

.btn-edit {
    background: #339af0;
}

.btn-delete {
    background: #e74c3c;
}

.btn-publish {
    background: #51cf66;
}

.btn-unpublish {
    background: #ff9800;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s;
}

.modal-large {
    max-width: 800px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header .close {
    font-size: 32px;
    font-weight: 300;
    color: #999;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.3s;
}

.modal-header .close:hover {
    color: #333;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 2px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Form Styles */
.form-section {
    margin-bottom: 25px;
}

.form-section h3 {
    font-size: 18px;
    color: #1a1a1a;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
}

textarea {
    resize: vertical;
    font-family: monospace;
}

small {
    color: #999;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-container {
        padding: 0 10px;
        margin: 15px auto;
    }

    .admin-header h1 {
        font-size: 24px;
    }

    .admin-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
        justify-content: space-between;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        font-size: 12px;
        padding: 8px 12px;
    }

    .search-input {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* 🔧 MOBILE TABLE SCROLL FIX */
    .table-container {
        margin: 0 -10px;
        /* Extend to edges */
        border-radius: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .admin-table {
        font-size: 12px;
        min-width: 650px;
        /* Force horizontal scroll if needed */
    }

    .admin-table th,
    .admin-table td {
        padding: 10px 8px;
    }

    .admin-table th {
        font-size: 11px;
    }

    .action-btn {
        padding: 5px 8px;
        font-size: 11px;
        margin-right: 3px;
    }

    /* Stats grid mobile */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 15px;
        gap: 10px;
    }

    .stat-icon {
        width: 45px;
        height: 45px;
        font-size: 22px;
    }

    .stat-info h3 {
        font-size: 20px;
    }

    .stat-info p {
        font-size: 12px;
    }
}

/* Move Buttons (Up/Down Arrows) */
.btn-move {
    padding: 6px 10px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
    margin-right: 3px;
}

.btn-move:hover {
    background: #5a6268;
}

.btn-move i {
    display: block;
}

/* ========== SCRAPER TRIGGER BUTTON ========== */
.stat-card.scraper-card {
    position: relative;
    flex-wrap: wrap;
    gap: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.scraper-card .stat-icon {
    background: rgba(255, 255, 255, 0.2) !important;
}

.scraper-card .stat-info h3 {
    color: white;
    font-size: 20px;
}

.scraper-card .stat-info p {
    color: rgba(255, 255, 255, 0.8);
}

.scraper-btn {
    padding: 12px 24px;
    background: white;
    color: #764ba2;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.scraper-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.scraper-btn:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

.scraper-btn i {
    font-size: 20px;
}

/* Responsive for scraper card */
@media (max-width: 768px) {
    .stat-card.scraper-card {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .scraper-btn {
        width: 100%;
        justify-content: center;
    }
}