@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@100;200;300;400;500;600;700&display=swap');

/* General Container */
.wgc-container { max-width: 800px; margin: auto; font-family: sans-serif; }
.wgc-container h1 { text-align: center; }

/* --- Step 1: Selection Grid --- */
.wgc-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}
.wgc-selection-grid .wgc-card-select-trigger {
    display: block;
    border: 3px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.wgc-selection-grid .wgc-card-select-trigger:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}
.wgc-selection-grid img { width: 100%; display: block; }

/* --- Mobile Responsive --- */
@media (max-width: 767px) {
  .wgc-selection-grid {
    /* * บังคับให้เป็น 2 คอลัมน์ (1fr 1fr)
     * แทนที่ 'repeat(auto-fit, minmax(200px, 1fr))' 
     * เมื่อหน้าจอเล็กกว่า 767px
    */
    grid-template-columns: repeat(2, 1fr);
  }
}


/* --- Modal Styles --- */
.wgc-modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    padding-top: 50px;
}
.wgc-modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 30px;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    position: relative;
}
.wgc-modal-content h2 {
    font-family: "IBM Plex Sans Thai", Sans-serif;
    font-weight: 600;
    line-height: 1.3em;
    color: #FF83AF;
    text-align: center;
}
.wgc-modal-close {
    color: #aaa;
    position: absolute;
    top: 10px; right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.wgc-modal-close:hover { color: black; }

/* --- Step 2: Write Form & Live Preview --- */
#wgc-write-modal .modal-body { font-family: "IBM Plex Sans Thai", Sans-serif; display: flex; gap: 20px; flex-wrap: wrap; }
#wgc-write-modal .form-fields { flex: 1; min-width: 250px; }
#wgc-write-modal .live-preview { flex: 1; min-width: 250px; }
#wgc-write-modal label { font-weight: bold; display: block; margin-bottom: 5px; }
#wgc-write-modal input, #wgc-write-modal textarea { width: 100%; padding: 10px; margin-bottom: 15px; border-radius: 4px; border: 1px solid #DCDCDC; background-color: #fff;}
#wgc-write-modal .submit-button { font-family: "IBM Plex Sans Thai", Sans-serif; width: 100%; padding: 12px; font-size: 16px; background-color: #01B3C0; color: white; border: none; border-radius: 4px; cursor: pointer; }
.submit-button:disabled { background-color: #999; }
#wgc-preview-card {
    width: 100%;
    padding-top: 122.8%;
    background-size: cover;
    background-position: center;
    position: relative;
    color: black;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-shadow: 1px 1px 2px rgba(255,255,255,0.7);
    overflow: hidden;
}

#wgc-preview-text-container {
    position: absolute;
    top: 43%;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    text-align: center;
}

#wgc-preview-text {
    font-family: 'IBM Plex Sans Thai', 'IBMPlexSansThai-Light', sans-serif;
    font-size: 0.9em;
    line-height: 2;
}

#wgc-preview-author {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    text-align: center;
    font-family: 'IBM Plex Sans Thai', 'IBMPlexSansThai-Light', sans-serif;
    font-size: 0.7em;
    line-height: 1.8;
}

/* --- Step 3: Result Area --- */
#wgc-result-modal .wgc-result-area { text-align: center; }
#wgc-result-modal .wgc-result-area h2 { color: #01B3C0;}
#wgc-result-modal .wgc-result-area p { color: #686868; font-family: 'IBM Plex Sans Thai', 'IBMPlexSansThai-Light', sans-serif;}
#wgc-result-modal img { max-width: 100%; width: 412px; margin: 0 auto; }
.wgc-action-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px;}
.wgc-action-buttons .btn { text-decoration: none !important; color: white; padding: 10px 20px; border-radius: 5px; width: 100%;}
.wgc-header-creat-a-card { font-size:18px;}
.btn-download { font-family: 'IBM Plex Sans Thai', 'IBMPlexSansThai-Light', sans-serif; background-color: #FF83AF; }
.btn-facebook { font-family: 'IBM Plex Sans Thai', 'IBMPlexSansThai-Light', sans-serif; background-color: #01B3C0; }
.btn-email { font-family: 'IBM Plex Sans Thai', 'IBMPlexSansThai-Light', sans-serif; background-color: #C0ED48; }
.btn-new { font-family: 'IBM Plex Sans Thai', 'IBMPlexSansThai-Light', sans-serif; background-color: #B2B2B2; color: #ffffff;}
#wgc-spinner { display: none; margin: 20px auto; width: 40px; height: 40px; border: 4px solid #f3f3f3; border-top: 4px solid #3498db; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ================== ADDED EMAIL FORM STYLES ================== */
#wgc-email-modal { display: none; margin-top: 20px; border-top: 1px solid #eee; padding-top: 20px; }
#wgc-email-form { display: flex; gap: 10px; justify-content: center; }
#wgc-email-form input[type="email"] { font-family: 'IBM Plex Sans Thai', 'IBMPlexSansThai-Light', sans-serif; padding: 10px; width: 250px; border: 1px solid #DCDCDC; border-radius: 4px;}
#wgc-email-form button { font-family: 'IBM Plex Sans Thai', 'IBMPlexSansThai-Light', sans-serif; padding: 10px 20px; background-color: #C0ED48; color: #fff; border: none; border-radius: 4px; cursor: pointer;}
#wgc-email-form button:disabled { background-color: #999; }
#wgc-email-status { margin-top: 10px; font-weight: bold; font-family: 'IBM Plex Sans Thai', 'IBMPlexSansThai-Light', sans-serif;}