/**
 * RDConnect Social Media Admin - Overrides & Fixes
 * Corrected: January 4, 2026
 * 
 * Changes:
 * 1. Fix button colors (purple #845adf → cyan #0891b2)
 * 2. Uniform network display
 * 3. Gallery styling
 * 4. Multiple network selection UI
 */

/* ========================================
   CRITICAL FIX: Button Colors
   Replace purple YNEX theme with cyan
   ======================================== */

/* Type Publication Buttons - Fix btn-check colors */
.publication-type-selector .btn-check:checked + .btn {
    background-color: #0891b2 !important;
    border-color: #0891b2 !important;
    color: white !important;
}

.publication-type-selector .btn {
    border-color: #0891b2 !important;
    color: #0891b2 !important;
    transition: all 0.3s ease;
}

.publication-type-selector .btn:hover {
    background-color: rgba(8, 145, 178, 0.1);
}

/* Network Selection - Radio buttons */
.form-check-input:checked {
    background-color: #0891b2 !important;
    border-color: #0891b2 !important;
}

.form-check-input:focus {
    border-color: #0891b2 !important;
    box-shadow: 0 0 0 0.25rem rgba(8, 145, 178, 0.25) !important;
}

.form-check-input:hover {
    border-color: #06b6d4 !important;
}

/* ========================================
   Network Selection Cards
   ======================================== */

.card-radio {
    position: relative;
}

.card-radio input[type="radio"],
.card-radio input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.card-radio label {
    position: relative;
    padding: 12px;
    cursor: pointer;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: white;
}

.card-radio input:checked + label {
    border-color: #0891b2;
    background-color: rgba(8, 145, 178, 0.05);
}

.card-radio label:hover {
    border-color: #06b6d4;
    background-color: rgba(8, 145, 178, 0.03);
}

.card-radio .avatar {
    min-width: 44px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 20px;
}

/* ========================================
   Media Upload Zone
   ======================================== */

.media-upload-zone {
    border: 2px dashed #d0d9e8;
    border-radius: 8px;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
}

.media-upload-zone.dragover {
    border-color: #0891b2;
    background-color: rgba(8, 145, 178, 0.05);
}

.upload-placeholder {
    cursor: pointer;
    padding: 30px 20px;
    transition: all 0.3s ease;
}

.upload-placeholder:hover {
    color: #0891b2;
}

.media-upload-zone.dragover .upload-placeholder {
    color: #0891b2;
}

#mediaPreviewGrid {
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
}

/* ========================================
   Preview Section
   ======================================== */

.card-header.bg-primary {
    background-color: #0891b2 !important;
}

.social-preview {
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    background: white;
    overflow: hidden;
}

.facebook-preview {
    max-width: 100%;
}

.preview-header {
    background: white;
    border-bottom: 1px solid #e0e6ed;
}

.preview-content {
    padding: 16px;
    font-size: 14px;
    line-height: 1.6;
}

.preview-text {
    color: #2a3f5f;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.preview-media {
    border-radius: 8px;
    overflow: hidden;
}

.preview-link {
    border: 1px solid #e0e6ed;
    border-radius: 8px;
}

.preview-actions {
    display: flex;
    justify-content: space-around;
    border-top: 1px solid #e0e6ed;
    padding: 12px;
    color: #6c757d;
    font-size: 13px;
    cursor: pointer;
}

.preview-actions span:hover {
    color: #0891b2;
}

/* ========================================
   Form Elements Styling
   ======================================== */

.form-label {
    color: #2a3f5f;
    font-weight: 600;
    margin-bottom: 8px;
}

.form-control,
.form-select {
    border-color: #d0d9e8 !important;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: #0891b2 !important;
    box-shadow: 0 0 0 0.2rem rgba(8, 145, 178, 0.1) !important;
}

.form-control::placeholder {
    color: #a1a5b7;
    opacity: 0.7;
}

/* ========================================
   Buttons Styling
   ======================================== */

.btn-primary {
    background-color: #0891b2 !important;
    border-color: #0891b2 !important;
}

.btn-primary:hover {
    background-color: #0e7490 !important;
    border-color: #0e7490 !important;
}

.btn-primary:focus {
    background-color: #0891b2 !important;
    border-color: #0891b2 !important;
    box-shadow: 0 0 0 0.25rem rgba(8, 145, 178, 0.5) !important;
}

.btn-outline-primary {
    color: #0891b2 !important;
    border-color: #0891b2 !important;
}

.btn-outline-primary:hover {
    background-color: #0891b2 !important;
    border-color: #0891b2 !important;
    color: white !important;
}

.btn-success {
    background-color: #10b981 !important;
    border-color: #10b981 !important;
}

.btn-success:hover {
    background-color: #059669 !important;
    border-color: #059669 !important;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ========================================
   Badge Colors - Network Status
   ======================================== */

.badge {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.bg-primary-transparent {
    background-color: rgba(8, 145, 178, 0.1) !important;
    color: #0891b2 !important;
}

.bg-success-transparent {
    background-color: rgba(16, 185, 129, 0.1) !important;
    color: #10b981 !important;
}

.bg-warning-transparent {
    background-color: rgba(245, 158, 11, 0.1) !important;
    color: #f59e0b !important;
}

.bg-danger-transparent {
    background-color: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
}

/* ========================================
   Network Cards (Uniform Display)
   ======================================== */

.network-card {
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
    background: white;
}

.network-card:hover {
    border-color: #0891b2;
    box-shadow: 0 2px 8px rgba(8, 145, 178, 0.1);
}

.network-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e6ed;
}

.network-card-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #2a3f5f;
}

.network-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.network-card-status {
    display: flex;
    gap: 8px;
}

.network-card-status .badge {
    font-size: 11px;
    padding: 4px 8px;
}

.network-card-content {
    margin-bottom: 12px;
}

.network-card-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid #f0f1f3;
}

.network-card-row:last-child {
    border-bottom: none;
}

.network-card-label {
    width: 120px;
    color: #6c757d;
    font-size: 13px;
    font-weight: 500;
}

.network-card-value {
    flex: 1;
    color: #2a3f5f;
    font-size: 13px;
    word-break: break-all;
    font-family: 'Courier New', monospace;
    background-color: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
}

.network-card-link {
    color: #0891b2;
    text-decoration: none;
    transition: color 0.3s ease;
}

.network-card-link:hover {
    color: #06b6d4;
    text-decoration: underline;
}

.network-card-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #e0e6ed;
}

.network-card-actions .btn {
    flex: 1;
    font-size: 12px;
    padding: 8px 12px;
}

/* ========================================
   Gallery Grid
   ======================================== */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    padding: 12px;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.gallery-item:hover {
    border-color: #0891b2;
    box-shadow: 0 2px 8px rgba(8, 145, 178, 0.15);
}

.gallery-item img,
.gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item.selected {
    border-color: #0891b2;
    box-shadow: inset 0 0 0 2px #0891b2;
}

.gallery-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(8, 145, 178, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.gallery-item:hover .gallery-item-overlay {
    display: flex;
}

.gallery-item.selected .gallery-item-overlay {
    display: flex;
}

/* ========================================
   Spinner & Loading
   ======================================== */

.spinner-border {
    border-color: rgba(8, 145, 178, 0.2) !important;
    border-right-color: #0891b2 !important;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .network-card-row {
        flex-direction: column;
    }
    
    .network-card-label {
        width: 100%;
        margin-bottom: 4px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    .publication-type-selector {
        flex-direction: column;
    }
    
    .publication-type-selector .btn {
        width: 100%;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .btn, .form-control, .form-select {
        border: 1px solid #999;
        padding: 4px 8px;
    }
    
    .preview-section {
        page-break-inside: avoid;
    }
}

/* ========================================
   Accessibility Improvements
   ======================================== */

.form-check-input:focus {
    outline: 2px solid #0891b2;
    outline-offset: 2px;
}

.btn:focus {
    outline: 2px solid #0891b2;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: more) {
    .network-card {
        border-width: 2px;
    }
    
    .btn {
        font-weight: 700;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}
