/**
 * Guard Dog Customizer Styles
 *
 * Styles for the visual customization interface
 *
 * @package GuardDog
 * @since 1.8.45
 */

/* ===== CUSTOMIZER WRAPPER ===== */
.wrap.guard-dog-customizer {
    margin-right: 20px;
}

.guard-dog-customizer h1 {
    margin-bottom: 10px;
}

.guard-dog-customizer > .description {
    margin-bottom: 20px;
    font-size: 14px;
    color: #646970;
}

/* ===== MAIN CONTAINER ===== */
.customizer-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
    min-height: 700px;
}

/* ===== CONTROLS PANEL ===== */
.customizer-controls {
    flex: 0 0 400px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    max-height: 800px;
    overflow-y: auto;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.customizer-controls::-webkit-scrollbar {
    width: 12px;
}

.customizer-controls::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.customizer-controls::-webkit-scrollbar-thumb {
    background: #c3c4c7;
    border-radius: 6px;
}

.customizer-controls::-webkit-scrollbar-thumb:hover {
    background: #8c8f94;
}

/* ===== SECTIONS ===== */
.customizer-section {
    border-bottom: 1px solid #dcdcde;
    padding: 20px;
}

.customizer-section:last-child {
    border-bottom: none;
}

.customizer-section-title {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1d2327;
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.customizer-section-title:before {
    content: "\f347"; /* dashicons-arrow-down */
    font-family: dashicons;
    font-size: 20px;
    margin-right: 5px;
    transition: transform 0.2s;
}

.customizer-section.collapsed .customizer-section-title:before {
    transform: rotate(-90deg);
}

.customizer-section.collapsed .customizer-section-controls {
    display: none;
}

.customizer-section > .description {
    margin: -10px 0 15px 0;
    font-size: 13px;
    color: #646970;
    font-style: italic;
}

.customizer-section-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ===== CONTROLS ===== */
.customizer-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.customizer-control-label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #1d2327;
    margin: 0;
}

.customizer-control .description {
    margin: 0;
    font-size: 12px;
    color: #646970;
    font-style: italic;
    line-height: 1.5;
}

.customizer-control input[type="text"],
.customizer-control input[type="number"],
.customizer-control textarea {
    width: 100%;
    max-width: 100%;
}

.customizer-control input[type="number"].small-text {
    width: 80px;
}

.customizer-control textarea {
    resize: vertical;
}

/* ===== COLOR PICKER ===== */
.customizer-control .wp-color-result {
    height: 32px;
}

.customizer-control .wp-picker-container {
    display: block;
}

.customizer-control .wp-picker-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.customizer-control .wp-picker-input-wrap input[type="text"] {
    flex: 1;
}

/* ===== IMAGE CONTROL ===== */
.guard-dog-image-control {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-preview-wrapper {
    border: 2px dashed #c3c4c7;
    border-radius: 4px;
    padding: 15px;
    text-align: center;
    background: #f9f9f9;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview {
    max-width: 100%;
    max-height: 150px;
    height: auto;
    border-radius: 2px;
}

.image-preview-placeholder {
    color: #8c8f94;
    text-align: center;
}

.image-preview-placeholder .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #c3c4c7;
}

.image-preview-placeholder p {
    margin: 10px 0 0 0;
    font-size: 13px;
}

.image-control-buttons {
    display: flex;
    gap: 8px;
}

.image-control-buttons .button {
    display: flex;
    align-items: center;
    gap: 5px;
}

.image-control-buttons .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ===== CHARACTER COUNT ===== */
.char-count {
    margin: 5px 0 0 0;
    font-size: 12px;
    color: #646970;
    text-align: right;
}

.char-count .current-count {
    font-weight: 600;
}

.char-count.over-limit .current-count {
    color: #d63638;
}

/* ===== PREVIEW PANEL ===== */
.customizer-preview {
    flex: 1;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.customizer-preview-header {
    padding: 15px 20px;
    border-bottom: 1px solid #dcdcde;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f6f7f7;
}

.customizer-preview-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1d2327;
}

.preview-device-buttons {
    display: flex;
    gap: 5px;
}

.preview-device {
    padding: 5px 10px !important;
    min-width: 36px;
    height: 32px;
    border: 1px solid #c3c4c7;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-device:hover {
    border-color: #2271b1;
    color: #2271b1;
}

.preview-device.active {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}

.preview-device .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* ===== PREVIEW FRAME ===== */
.customizer-preview-frame {
    flex: 1;
    padding: 20px;
    background: #f0f0f1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: auto;
}

.customizer-preview-frame:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(90deg, transparent 79px, #c3c4c7 79px, #c3c4c7 81px, transparent 81px),
        linear-gradient(#c3c4c7 1px, transparent 1px);
    background-size: 80px 80px;
    opacity: 0.05;
    pointer-events: none;
}

#customizer-preview-iframe {
    border: 1px solid #c3c4c7;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    position: relative;
    z-index: 1;
}

/* Device-specific iframe sizes */
.customizer-preview-frame[data-device="desktop"] #customizer-preview-iframe {
    width: 100%;
    height: 100%;
    min-height: 600px;
}

.customizer-preview-frame[data-device="tablet"] #customizer-preview-iframe {
    width: 768px;
    height: 1024px;
    max-width: 100%;
}

.customizer-preview-frame[data-device="mobile"] #customizer-preview-iframe {
    width: 375px;
    height: 667px;
    max-width: 100%;
}

/* ===== PREVIEW LOADING STATE ===== */
.customizer-preview-frame.loading:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2271b1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 2;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ===== PREVIEW ACTIONS ===== */
.customizer-preview-actions {
    padding: 15px 20px;
    border-top: 1px solid #dcdcde;
    background: #f6f7f7;
}

.customizer-preview-actions .button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.customizer-preview-actions .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ===== ACTION BUTTONS ===== */
.customizer-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 20px 0;
    border-top: 1px solid #c3c4c7;
    margin-top: 20px;
}

.customizer-actions .button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.customizer-actions .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.customizer-actions .button.loading {
    pointer-events: none;
    opacity: 0.6;
}

.customizer-actions .button.loading:before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 5px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.customizer-actions .button-primary.loading:before {
    border-color: #fff;
    border-top-color: transparent;
}

/* ===== STATUS INDICATOR ===== */
.customizer-status {
    margin-top: 15px;
    padding: 12px 15px;
    background: #f0f6fc;
    border-left: 4px solid #2271b1;
    border-radius: 3px;
}

.customizer-status.theme-override {
    background: #fcf9e8;
    border-left-color: #dba617;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
}

.status-indicator .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.status-indicator.database-settings {
    color: #2271b1;
}

.status-indicator.theme-override {
    color: #996800;
}

/* ===== NOTICES ===== */
.customizer-notice {
    margin: 15px 0;
    padding: 12px 15px;
    border-left: 4px solid;
    background: #fff;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.customizer-notice.success {
    border-left-color: #00a32a;
    background: #f0f6fc;
}

.customizer-notice.error {
    border-left-color: #d63638;
    background: #fcf0f1;
}

.customizer-notice.info {
    border-left-color: #2271b1;
    background: #f0f6fc;
}

.customizer-notice.warning {
    border-left-color: #dba617;
    background: #fcf9e8;
}

.customizer-notice p {
    margin: 0;
    font-size: 13px;
}

.customizer-notice .dashicons {
    vertical-align: middle;
    margin-right: 5px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media screen and (max-width: 1400px) {
    .customizer-controls {
        flex: 0 0 350px;
    }
}

@media screen and (max-width: 1200px) {
    .customizer-container {
        flex-direction: column;
    }

    .customizer-controls {
        flex: 1;
        max-height: 400px;
    }

    .customizer-preview {
        min-height: 600px;
    }
}

@media screen and (max-width: 782px) {
    .customizer-controls {
        max-height: 300px;
    }

    .customizer-preview-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .preview-device-buttons {
        width: 100%;
        justify-content: space-between;
    }

    .customizer-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .customizer-actions .button {
        justify-content: center;
    }
}

/* ===== ACCESSIBILITY ===== */
.customizer-control:focus-within .customizer-control-label {
    color: #2271b1;
}

.preview-device:focus {
    box-shadow: 0 0 0 1px #2271b1;
    outline: 2px solid transparent;
}

button:focus {
    box-shadow: 0 0 0 1px #2271b1;
    outline: 2px solid transparent;
}

/* ===== ANIMATIONS ===== */
.customizer-notice {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== UTILITIES ===== */
.hidden {
    display: none !important;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== CUSTOMIZER LANDING PAGE ===== */
.guard-dog-customizer-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.guard-dog-customizer-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease;
}

.guard-dog-customizer-card:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.guard-dog-customizer-card-header {
    padding: 20px;
    border-bottom: 1px solid #c3c4c7;
    display: flex;
    align-items: center;
    gap: 12px;
}

.guard-dog-customizer-card-header .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: #2271b1;
}

.guard-dog-customizer-card-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1d2327;
}

.guard-dog-customizer-card-content {
    padding: 20px;
    flex: 1;
}

.guard-dog-customizer-card-content p {
    margin: 0;
    color: #646970;
    line-height: 1.6;
}

.guard-dog-customizer-card-footer {
    padding: 20px;
    border-top: 1px solid #c3c4c7;
    background: #f6f7f7;
}

.guard-dog-customizer-card-footer .button {
    width: 100%;
    text-align: center;
    justify-content: center;
}
