/**
 * Admin styles for eslamdev-fcb Floating Buttons
 * Clean, Simple & Organized Design
 *
 * @package eslamdev-fcbFloatingButtons
 * @since 1.0.0
 */

/* =====================================================
   CSS Variables
   ===================================================== */
:root {
    --eslamdev-fcb-primary: #667eea;
    --eslamdev-fcb-secondary: #764ba2;
    --eslamdev-fcb-success: #10b981;
    --eslamdev-fcb-danger: #ef4444;
    --eslamdev-fcb-dark: #1e293b;
    --eslamdev-fcb-gray: #64748b;
    --eslamdev-fcb-light: #f8fafc;
    --eslamdev-fcb-border: #e2e8f0;
    --eslamdev-fcb-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

[dir="rtl"] .eslamdev-fcb-settings-wrap,
.rtl .eslamdev-fcb-settings-wrap {
    font-family: 'Tajawal', 'Arial', sans-serif;
}

/* =====================================================
   Settings Page Container
   ===================================================== */
.eslamdev-fcb-settings-wrap {
    max-width: 1100px;
    margin: 20px 20px 20px 0;
}

.eslamdev-fcb-settings-wrap h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--eslamdev-fcb-dark);
    margin-bottom: 20px;
}

.eslamdev-fcb-settings-container {
    display: flex;
    gap: 24px;
}

/* =====================================================
   Main Settings Area
   ===================================================== */
.eslamdev-fcb-settings-main {
    flex: 1;
    background: #fff;
    border: 1px solid var(--eslamdev-fcb-border);
    border-radius: var(--eslamdev-fcb-radius);
    padding: 20px 24px;
}

.eslamdev-fcb-settings-sidebar {
    width: 320px;
    flex-shrink: 0;
}

/* =====================================================
   Form Styles
   ===================================================== */
.eslamdev-fcb-settings-main .form-table {
    margin-top: 0;
}

.eslamdev-fcb-settings-main .form-table th {
    width: 180px;
    padding: 14px 10px 14px 0;
    font-weight: 500;
    font-size: 13px;
    color: var(--eslamdev-fcb-dark);
}

.eslamdev-fcb-settings-main .form-table td {
    padding: 14px 10px;
}

.eslamdev-fcb-settings-main input[type="text"],
.eslamdev-fcb-settings-main input[type="url"],
.eslamdev-fcb-settings-main select {
    width: 100%;
    max-width: 320px;
    padding: 8px 12px;
    border: 1px solid var(--eslamdev-fcb-border);
    border-radius: 6px;
    font-size: 13px;
    transition: border-color 0.2s;
}

.eslamdev-fcb-settings-main input[type="text"]:focus,
.eslamdev-fcb-settings-main input[type="url"]:focus,
.eslamdev-fcb-settings-main select:focus {
    border-color: var(--eslamdev-fcb-primary);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
    outline: none;
}

.eslamdev-fcb-settings-main .description {
    color: var(--eslamdev-fcb-gray);
    font-size: 11px;
    margin-top: 4px;
}

/* =====================================================
   Section Headers
   ===================================================== */
.eslamdev-fcb-settings-main h2 {
    font-size: 14px;
    font-weight: 600;
    margin: 24px 0 12px;
    padding-bottom: 8px;
    color: var(--eslamdev-fcb-dark);
    border-bottom: 1px solid var(--eslamdev-fcb-border);
}

.eslamdev-fcb-settings-main h2:first-of-type {
    margin-top: 0;
}

/* =====================================================
   iOS-Style Toggle Switches
   ===================================================== */
.eslamdev-fcb-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.eslamdev-fcb-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.eslamdev-fcb-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.eslamdev-fcb-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: all 0.3s;
    border-radius: 22px;
}

.eslamdev-fcb-toggle-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: all 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.eslamdev-fcb-toggle input:checked+.eslamdev-fcb-toggle-slider {
    background: var(--eslamdev-fcb-primary);
}

.eslamdev-fcb-toggle input:checked+.eslamdev-fcb-toggle-slider::before {
    transform: translateX(18px);
}

.eslamdev-fcb-toggle-label {
    font-size: 13px;
    color: var(--eslamdev-fcb-dark);
}

/* =====================================================
   Sidebar Boxes
   ===================================================== */
.eslamdev-fcb-preview-box,
.eslamdev-fcb-info-box,
.eslamdev-fcb-developer-box {
    background: #fff;
    border: 1px solid var(--eslamdev-fcb-border);
    border-radius: var(--eslamdev-fcb-radius);
    padding: 16px;
    margin-bottom: 16px;
}

.eslamdev-fcb-preview-box h3,
.eslamdev-fcb-info-box h3 {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--eslamdev-fcb-dark);
}

/* =====================================================
   Preview Area
   ===================================================== */
.eslamdev-fcb-preview-area {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
    min-height: 450px;
    position: relative;
    overflow: visible;
}

.eslamdev-fcb-preview-buttons,
#eslamdev-fcb-preview-container {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s ease;
}

.eslamdev-fcb-preview-buttons.eslamdev-fcb-position-left,
#eslamdev-fcb-preview-container.eslamdev-fcb-position-left {
    right: auto;
    left: 16px;
}

.eslamdev-fcb-preview-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    /* Critical for label positioning */
}

.eslamdev-fcb-preview-btn:hover {
    transform: scale(1.1);
}

.eslamdev-fcb-preview-btn svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

.eslamdev-fcb-preview-btn.eslamdev-fcb-whatsapp {
    background: #25D366;
}

.eslamdev-fcb-preview-btn.eslamdev-fcb-telegram {
    background: #2AABEE;
}

.eslamdev-fcb-preview-btn.eslamdev-fcb-discord {
    background: #5865F2;
}

.eslamdev-fcb-preview-btn.eslamdev-fcb-facebook {
    background: #0084FF;
}



/* =====================================================
   Info Box
   ===================================================== */
.eslamdev-fcb-info-box ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.eslamdev-fcb-info-box li {
    padding: 6px 0;
    padding-left: 16px;
    position: relative;
    font-size: 12px;
    color: var(--eslamdev-fcb-gray);
    line-height: 1.4;
}

.eslamdev-fcb-info-box li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--eslamdev-fcb-primary);
}

/* =====================================================
   Developer Box
   ===================================================== */
.eslamdev-fcb-developer-box {
    text-align: center;
}

.eslamdev-fcb-developer-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.eslamdev-fcb-developer-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--eslamdev-fcb-primary), var(--eslamdev-fcb-secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eslamdev-fcb-avatar-icon {
    font-size: 20px;
}

.eslamdev-fcb-developer-info {
    text-align: left;
}

.eslamdev-fcb-developer-info h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--eslamdev-fcb-dark);
}

.eslamdev-fcb-developer-badge {
    font-size: 11px;
    color: var(--eslamdev-fcb-primary);
    font-weight: 500;
}

.eslamdev-fcb-developer-contact {
    padding: 10px 0;
    border-top: 1px solid var(--eslamdev-fcb-border);
    border-bottom: 1px solid var(--eslamdev-fcb-border);
    margin-bottom: 12px;
}

.eslamdev-fcb-contact-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--eslamdev-fcb-gray);
    text-decoration: none;
    font-size: 12px;
}

.eslamdev-fcb-contact-link:hover {
    color: var(--eslamdev-fcb-primary);
}

.eslamdev-fcb-developer-actions {
    display: flex;
    gap: 8px;
}

.eslamdev-fcb-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
}

.eslamdev-fcb-btn-primary {
    background: var(--eslamdev-fcb-primary);
    color: #fff;
}

.eslamdev-fcb-btn-primary:hover {
    background: #5a6fd6;
    color: #fff;
}

.eslamdev-fcb-btn-outline {
    border: 1px solid var(--eslamdev-fcb-border);
    color: var(--eslamdev-fcb-dark);
    background: #fff;
}

.eslamdev-fcb-btn-outline:hover {
    border-color: var(--eslamdev-fcb-primary);
    color: var(--eslamdev-fcb-primary);
}

/* =====================================================
   Custom Buttons Section
   ===================================================== */
#eslamdev-fcb-custom-buttons-container {
    margin-bottom: 12px;
}

.eslamdev-fcb-custom-button-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: var(--eslamdev-fcb-light);
    border: 1px solid var(--eslamdev-fcb-border);
    border-radius: 6px;
    margin-bottom: 8px;
}

.eslamdev-fcb-custom-button-fields {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.eslamdev-fcb-field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.eslamdev-fcb-field-group label {
    font-size: 11px;
    font-weight: 500;
    color: var(--eslamdev-fcb-gray);
    text-transform: uppercase;
}

.eslamdev-fcb-field-group input[type="text"],
.eslamdev-fcb-field-group input[type="url"] {
    width: 100%;
    max-width: none;
    padding: 6px 10px;
    font-size: 12px;
}

.eslamdev-fcb-field-icon {
    grid-column: 1;
}

.eslamdev-fcb-field-color {
    grid-column: 2;
}

/* Icon Upload */
.eslamdev-fcb-icon-upload {
    display: flex;
    align-items: center;
    gap: 8px;
}

.eslamdev-fcb-icon-preview {
    width: 32px;
    height: 32px;
    background: #fff;
    border: 1px dashed var(--eslamdev-fcb-border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.eslamdev-fcb-icon-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.eslamdev-fcb-upload-icon-btn {
    padding: 5px 10px !important;
    font-size: 11px !important;
    background: var(--eslamdev-fcb-primary) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 4px !important;
}

.eslamdev-fcb-remove-icon-btn {
    padding: 5px 8px !important;
    font-size: 12px !important;
    color: var(--eslamdev-fcb-danger) !important;
    border: 1px solid var(--eslamdev-fcb-danger) !important;
    background: transparent !important;
    border-radius: 4px !important;
}

.eslamdev-fcb-remove-custom-button {
    width: 32px;
    height: 32px;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ef4444 !important;
    /* Red color always */
    border: none !important;
    background: transparent !important;
    border-radius: 6px !important;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-top: 22px;
    /* Align with input fields (skip label) */
}

.eslamdev-fcb-remove-custom-button:hover {
    color: #dc2626 !important;
    background: transparent !important;
    transform: scale(1.1);
}

.eslamdev-fcb-remove-custom-button .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 1;
}

/* Custom button preview styling */
.eslamdev-fcb-preview-btn-custom {
    /* Sizes handled by JS */
}

.eslamdev-fcb-preview-btn-custom img {
    object-fit: contain;
}

.eslamdev-fcb-preview-btn-custom svg {
    fill: #fff;
}

#eslamdev-fcb-add-custom-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px !important;
    font-size: 12px !important;
    background: var(--eslamdev-fcb-primary) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
}

#eslamdev-fcb-add-custom-button .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* =====================================================
   Color Picker
   ===================================================== */
.wp-picker-container .wp-color-result {
    margin: 0;
    border-radius: 4px;
}

/* =====================================================
   Submit Button
   ===================================================== */
.eslamdev-fcb-settings-main .submit {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--eslamdev-fcb-border);
}

.eslamdev-fcb-settings-main #submit {
    padding: 10px 24px !important;
    font-size: 13px !important;
    background: var(--eslamdev-fcb-primary) !important;
    border: none !important;
    border-radius: 6px !important;
}

/* =====================================================
   Toast Notifications
   ===================================================== */
.eslamdev-fcb-toast-container {
    position: fixed;
    top: 40px;
    right: 20px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.eslamdev-fcb-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    max-width: 360px;
    animation: eslamdev-fcb-toast-in 0.3s ease;
}

.eslamdev-fcb-toast.eslamdev-fcb-toast-out {
    animation: eslamdev-fcb-toast-out 0.2s ease forwards;
}

@keyframes eslamdev-fcb-toast-in {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes eslamdev-fcb-toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(50px);
    }
}

.eslamdev-fcb-toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.eslamdev-fcb-toast-success .eslamdev-fcb-toast-icon {
    background: var(--eslamdev-fcb-success);
    color: #fff;
}

.eslamdev-fcb-toast-error .eslamdev-fcb-toast-icon {
    background: var(--eslamdev-fcb-danger);
    color: #fff;
}

.eslamdev-fcb-toast-warning .eslamdev-fcb-toast-icon {
    background: #f59e0b;
    color: #fff;
}

.eslamdev-fcb-toast-info .eslamdev-fcb-toast-icon {
    background: var(--eslamdev-fcb-primary);
    color: #fff;
}

.eslamdev-fcb-toast-content {
    flex: 1;
}

.eslamdev-fcb-toast-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--eslamdev-fcb-dark);
}

.eslamdev-fcb-toast-message {
    font-size: 12px;
    color: var(--eslamdev-fcb-gray);
}

.eslamdev-fcb-toast-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 2px;
    font-size: 16px;
    line-height: 1;
}

/* Hide WordPress default notices */
.eslamdev-fcb-settings-wrap .notice,
.eslamdev-fcb-settings-wrap .updated,
.eslamdev-fcb-settings-wrap .error {
    display: none !important;
}

/* =====================================================
   Responsive
   ===================================================== */
@media screen and (max-width: 1024px) {
    .eslamdev-fcb-settings-container {
        flex-direction: column;
    }

    .eslamdev-fcb-settings-sidebar {
        width: 100%;
    }
}

@media screen and (max-width: 600px) {

    .eslamdev-fcb-settings-main .form-table th,
    .eslamdev-fcb-settings-main .form-table td {
        display: block;
        padding: 8px 0;
    }

    .eslamdev-fcb-settings-main .form-table th {
        padding-bottom: 4px;
    }

    .eslamdev-fcb-custom-button-fields {
        grid-template-columns: 1fr;
    }

    .eslamdev-fcb-field-icon,
    .eslamdev-fcb-field-color {
        grid-column: auto;
    }
}

/* =====================================================
   Header Styling
   ===================================================== */
.eslamdev-fcb-header {
    text-align: center;
    margin: 30px 0 40px;
    display: flex;
    flex-direction: row;
    /* Horizontal alignment */
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.eslamdev-fcb-logo-img {
    width: 50px;
    height: auto;
    object-fit: contain;
}

/* =====================================================
   Preview Labels
   ===================================================== */
.eslamdev-fcb-label {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    margin-right: 12px;
    background: #1e1e1e;
    color: #fff !important;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
    line-height: 1.4;
}

.eslamdev-fcb-label::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #1e1e1e;
}

/* Position Left Support */
.eslamdev-fcb-position-left .eslamdev-fcb-label {
    right: auto;
    left: 100%;
    margin-right: 0;
    margin-left: 12px;
    transform: translateY(-50%) translateX(-10px);
}

.eslamdev-fcb-position-left .eslamdev-fcb-label::after {
    right: auto;
    left: -6px;
    border-left-color: transparent;
    border-right-color: #1e1e1e;
}

/* Show labels on hover - ONLY if enabled in preview container */
.eslamdev-fcb-show-labels .eslamdev-fcb-preview-btn:hover .eslamdev-fcb-label {
    opacity: 1;
    visibility: visible;
    margin-right: 12px !important;
    transform: translateY(-50%) translateX(0);
}

.eslamdev-fcb-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--eslamdev-fcb-dark);
    margin: 0;
    line-height: 1.2;
}

/* Adjust Settings Wrap for Centered Header */
.eslamdev-fcb-settings-wrap h1 {
    display: none;
    /* Hide default WP h1 if present outside our container */
}

.eslamdev-fcb-header h1 {
    display: block;
    /* Ensure our h1 is visible */
}
