/* ============================================================
   meta-tag-generator / style.css
   Prefix: mtg-
   ============================================================ */

/* --- Container --- */
.mtg-container {
    max-width: 1000px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- Main Grid (form + preview) --- */
.mtg-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 40px;
    align-items: flex-start;
}

.mtg-form-area {
    flex: 1 1 380px;
    background: #fdfdfd;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    border: 1px solid #eee;
    box-sizing: border-box;
}

.mtg-preview-area {
    flex: 1 1 440px;
    box-sizing: border-box;
}

/* --- Form Section Headings --- */
.mtg-section-title {
    margin-top: 24px;
    margin-bottom: 16px;
    font-size: 15px;
    font-weight: 700;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px;
    display: inline-block;
    color: #1a1a1a;
}

.mtg-section-title:first-child {
    margin-top: 0;
}

/* --- Input Groups --- */
.mtg-input-group {
    margin-bottom: 16px;
}

.mtg-input-group label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 5px;
    color: #333;
}

.mtg-input-group label .mtg-required {
    color: #d32f2f;
    font-size: 11px;
    margin-left: 4px;
}

.mtg-input-group label .mtg-optional {
    color: #888;
    font-size: 11px;
    font-weight: 400;
    margin-left: 4px;
}

.mtg-input,
.mtg-textarea,
.mtg-select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    color: #1a1a1a;
}

.mtg-input:focus,
.mtg-textarea:focus,
.mtg-select:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.mtg-textarea {
    resize: vertical;
    min-height: 75px;
    line-height: 1.5;
}

/* Color input group */
.mtg-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mtg-color-input {
    width: 42px;
    height: 36px;
    padding: 3px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    background: #fff;
    flex-shrink: 0;
}

.mtg-color-hex {
    flex: 1;
}

/* Char counter */
.mtg-char-counter {
    display: block;
    text-align: right;
    font-size: 11px;
    color: #999;
    margin-top: 3px;
}

.mtg-char-counter.mtg-warn {
    color: #e67e22;
}

.mtg-char-counter.mtg-ok {
    color: #27ae60;
}

/* ============================================================
   Preview: Google Search Result
   ============================================================ */
.mtg-google-preview-wrap {
    margin-bottom: 20px;
}

.mtg-google-preview-label {
    font-size: 12px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mtg-google-preview-label::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%234285F4' d='M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z'/%3E%3Cpath fill='%2334A853' d='M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z'/%3E%3Cpath fill='%23FBBC05' d='M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z'/%3E%3Cpath fill='%23EA4335' d='M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.mtg-google-card {
    background: #fff;
    border: 1px solid #dfe1e5;
    border-radius: 8px;
    padding: 16px 20px;
    font-family: arial, sans-serif;
    max-width: 600px;
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.1);
}

.mtg-google-breadcrumb {
    font-size: 13px;
    color: #202124;
    line-height: 1.3;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mtg-google-breadcrumb span.mtg-bc-domain {
    font-weight: 500;
}

.mtg-google-title {
    font-size: 20px;
    color: #1a0dab;
    font-weight: 400;
    line-height: 1.3;
    margin-bottom: 3px;
    text-decoration: none;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.mtg-google-title:hover {
    text-decoration: underline;
}

.mtg-google-desc {
    font-size: 14px;
    color: #4d5156;
    line-height: 1.58;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all;
}

/* ============================================================
   Preview: SNS (re-use ogp-simulator styles + tabs)
   ============================================================ */
.mtg-sns-preview-label {
    font-size: 12px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

/* Tab buttons */
.mtg-preview-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    flex-wrap: wrap;
}

.mtg-preview-tab-btn {
    padding: 5px 14px;
    border: 1px solid #ccc;
    background: #f9f9f9;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    transition: all 0.2s;
    white-space: nowrap;
}

.mtg-preview-tab-btn:hover {
    background: #eee;
}

.mtg-preview-tab-btn.active {
    background: #1da1f2;
    color: #fff;
    border-color: #1da1f2;
}

.mtg-preview-tab-btn[data-target="mtg-fb-mock"].active {
    background: #1877f2;
    border-color: #1877f2;
}

.mtg-card-preview-container {
    display: none;
}

.mtg-card-preview-container.active {
    display: block;
}

/* Twitter Card: Large */
.mtg-tw-card {
    border: 1px solid #cfd9de;
    border-radius: 16px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #0f1419;
    cursor: pointer;
    background: #fff;
    transition: background-color 0.2s;
    margin: 0 auto;
    text-decoration: none;
    display: block;
    max-width: 504px;
}

.mtg-tw-card:hover {
    background-color: #f7f9f9;
}

.mtg-tw-image-area {
    background-color: #e1e8ed;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

.mtg-tw-text-area {
    padding: 12px;
}

.mtg-tw-domain {
    color: #536471;
    font-size: 15px;
    line-height: 20px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mtg-tw-title {
    font-size: 15px;
    line-height: 20px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 400;
}

.mtg-tw-desc {
    color: #536471;
    font-size: 15px;
    line-height: 20px;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Large card */
.mtg-tw-large .mtg-tw-image-area {
    padding-bottom: 52.356%;
    border-bottom: 1px solid #cfd9de;
}

/* Small card */
.mtg-tw-small {
    display: flex;
    align-items: center;
}

.mtg-tw-small .mtg-tw-image-area {
    width: 130px;
    height: 130px;
    flex-shrink: 0;
    border-right: 1px solid #cfd9de;
}

.mtg-tw-small .mtg-tw-text-area {
    flex: 1;
    min-width: 0;
}

/* Facebook Card */
.mtg-fb-card {
    border: 1px solid #dadde1;
    background-color: #f2f3f5;
    overflow: hidden;
    font-family: Helvetica, Arial, sans-serif;
    max-width: 500px;
    margin: 0 auto;
}

.mtg-fb-image-area {
    width: 100%;
    padding-bottom: 52.356%;
    background-color: #e9ebee;
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid #dadde1;
    position: relative;
}

.mtg-fb-text-area {
    padding: 10px 12px;
}

.mtg-fb-domain {
    font-size: 12px;
    color: #606770;
    text-transform: uppercase;
    margin-bottom: 4px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mtg-fb-title {
    font-size: 16px;
    font-weight: 600;
    color: #1d2129;
    line-height: 20px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mtg-fb-desc {
    font-size: 14px;
    color: #606770;
    line-height: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mtg-img-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #8899a6;
    font-size: 24px;
    line-height: 1;
}

.mtg-fb-image-area .mtg-img-placeholder {
    color: #bec3c9;
}

/* Preview container inner padding */
.mtg-preview-inner {
    padding: 16px;
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 8px;
}

.mtg-preview-note {
    text-align: right;
    color: #999;
    font-size: 11px;
    margin-top: 10px;
}

/* ============================================================
   Code Output Area
   ============================================================ */
.mtg-code-area {
    margin-top: 40px;
    position: relative;
}

.mtg-code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #24292e;
    padding: 10px 16px;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    color: #fff;
    gap: 10px;
}

.mtg-code-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #c9d1d9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mtg-copy-btn {
    background: #007bff;
    color: #fff;
    border: none;
    padding: 5px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.mtg-copy-btn:hover {
    background: #0056b3;
}

.mtg-copy-btn.copied {
    background: #28a745;
}

.mtg-code-content {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 18px 20px;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    margin: 0;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 13px;
    line-height: 1.7;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    min-height: 120px;
}

/* Syntax highlight tokens */
.mtg-hl-tag {
    color: #cba6f7;
}

/* tag name: meta, link, title  */
.mtg-hl-attr {
    color: #89b4fa;
}

/* attribute name               */
.mtg-hl-val {
    color: #a6e3a1;
}

/* attribute value (string)     */
.mtg-hl-comment {
    color: #6c7086;
    font-style: italic;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .mtg-grid {
        flex-direction: column;
    }

    .mtg-form-area,
    .mtg-preview-area {
        flex: 1 1 100%;
    }

    .mtg-google-card {
        max-width: 100%;
    }

    .mtg-code-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}