/**
 * Plugin Name: Zeal Ad Manager
 * Author:      Edu Brazeal
 * Author URI:  https://banter.ng
 * Version:     1.2.0
 */

/**
 * TABLE OF CONTENTS
 * --------------------------------------------------------------------------
 * 1.0 - Modal Fullscreen Layout
 * 2.0 - Modal Header, Body, Footer
 * 3.0 - Step 1: Template Selection
 * 4.0 - Step 2: Editor Layout
 * 5.0 - Utility & Helper Classes
 * --------------------------------------------------------------------------
 */


/* --- 1.0 - Modal Fullscreen Layout --- */
.zam-modal-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(240, 240, 241, 0.95);
    z-index: 160000; /* High z-index to be above WordPress UI */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.zam-modal-fullscreen.zam-is-visible {
    opacity: 1;
    visibility: visible;
}

.zam-modal-fullscreen .zam-modal-content {
    background-color: #fff;
    width: 98%;
    height: 95vh;
    max-width: 1600px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.zam-modal-fullscreen.zam-is-visible .zam-modal-content {
    transform: scale(1);
}

/* --- 2.0 - Modal Header, Body, Footer --- */
.zam-modal-fullscreen .zam-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}

.zam-modal-fullscreen .zam-modal-header h2 {
    margin: 0;
    font-size: 20px;
}

.zam-modal-fullscreen .zam-modal-close-fullscreen {
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 0;
}

.zam-modal-fullscreen .zam-modal-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 30px;
}

.zam-modal-fullscreen .zam-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    border-top: 1px solid #ddd;
    background-color: #f9f9f9;
    flex-shrink: 0;
}


/* --- 3.0 - Step 1: Template Selection --- */
.zam-builder-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    max-width: 1000px;
    margin: 20px auto;
}

.zam-builder-template-option {
    border: 1px solid #ccc;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    background-color: #fff;
    overflow: hidden;
}

.zam-builder-template-option:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    border-color: #4A90E2;
}

.zam-builder-template-preview {
    background-color: #f0f0f0;
    padding: 15px;
    border-bottom: 1px solid #ddd;
}

.zam-builder-template-preview img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border: 1px solid #ddd;
}

.zam-builder-template-option h3 {
    margin: 0;
    padding: 15px;
    font-size: 16px;
}


/* --- 4.0 - Step 2: Editor Layout --- */
.zam-builder-editor-layout {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 30px;
    height: 100%;
}

.zam-builder-form-panel {
    border-right: 1px solid #ddd;
    padding-right: 30px;
    overflow-y: auto;
    height: 100%;
}

@media screen and (max-width: 767px) {
  .zam-builder-form-panel {
    width: 290px;
  }
}

.zam-builder-preview-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f4f4f4;
    border-radius: 8px;
    height: 100%;
    overflow: auto;
    padding: 20px;
}

@media screen and (max-width: 767px) {
  .zam-builder-preview-panel {
    width: 350px;
    margin-left: -175px;
  }
}

#zam-animated-ad-form .zam-form-row input[type="color"] {
    height: 44px;
    padding: 5px;
    max-width: 100px;
}

.zam-builder-template-form {
    display: none;
    border-top: 1px dashed #ccc;
    margin-top: 20px;
    padding-top: 20px;
}

.zam-builder-template-form.zam-is-active {
    display: block;
}

#zam-animated-ad-preview-container {
    transform: scale(1.2);
}

@media screen and (max-width: 767px) {
  #zam-animated-ad-preview-container {
    transform: scale(1.0);
  }
}

/* --- 5.0 - Utility & Helper Classes --- */
.zam-builder-hidden {
    display: none !important;
}