/* ------------------ Existing CID Form & Layout ------------------ */
.sg365-cid-wrap {
    max-width: 720px;
    margin: 0 auto;
    font-family: Arial, sans-serif;
}

.sg365-cid-wrap.sg365-font-poppins { font-family: 'Poppins', Arial, sans-serif; }
.sg365-cid-wrap.sg365-font-inter { font-family: 'Inter', Arial, sans-serif; }
.sg365-cid-wrap.sg365-font-montserrat { font-family: 'Montserrat', Arial, sans-serif; }
.sg365-cid-wrap.sg365-font-nunito { font-family: 'Nunito', Arial, sans-serif; }
.sg365-cid-wrap.sg365-font-worksans { font-family: 'Work Sans', Arial, sans-serif; }

.sg365-cid-wrap.sg365-label-bold label { font-weight: 700; }
.sg365-cid-wrap.sg365-label-normal label { font-weight: 400; }

.sg365-bg-gray { background: #f5f5f5; padding: 15px; border-radius: 10px; color:#0f172a; }
.sg365-bg-gray-yellow { background: linear-gradient(135deg, #f6f7f8, #fff9e6); padding: 15px; border-radius: 10px; color:#0f172a; }
.sg365-bg-white { background: #fff; padding: 15px; border-radius: 10px; color:#0f172a; }
.sg365-bg-sky { background: linear-gradient(135deg, #e9f3ff, #f7fbff); padding: 15px; border-radius: 10px; box-shadow: 0 8px 18px rgba(0,0,0,0.03); color:#0f172a; }
.sg365-bg-mint { background: linear-gradient(135deg, #ecfff5, #f6fffb); padding: 15px; border-radius: 10px; box-shadow: 0 8px 18px rgba(0,0,0,0.03); color:#0f172a; }
.sg365-bg-sand { background: linear-gradient(135deg, #faf6f0, #fffdf7); padding: 15px; border-radius: 10px; box-shadow: 0 8px 18px rgba(0,0,0,0.03); color:#0f172a; }

.sg365-cid-wrap input[type="text"],
.sg365-cid-wrap input[type="email"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.sg365-cid-box {
    padding: 12px;
    border: 1px solid #eaeaea;
    background: #fafafa;
    border-radius: 6px;
}

.sg365-success-note {
    margin-top: 8px;
    padding: 8px;
    background: #eef7ff;
    border: 1px dashed #9ac2ff;
}

.sg365-center-btn {
    text-align: center;
}
.sg365-btn-align-left .sg365-center-btn { text-align: left; }
.sg365-btn-align-right .sg365-center-btn { text-align: right; }
.sg365-btn-align-center .sg365-center-btn { text-align: center; }
.sg365-cta-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    padding: 12px 20px;
    background: var(--sg365-btn-color, #2271b1) !important;
    border-color: var(--sg365-btn-color, #2271b1) !important;
    color: #fff !important;
}
.sg365-btn-icon {
    font-size: 18px;
}

.sg365-cid-success .sg365-cid-code {
    display: block;
    padding: 10px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
    margin: 8px 0;
    font-family: monospace;
    word-break: break-all;
}

.sg365-cid-error {
    border-color: #ffd4d4;
    background: #fff5f5;
    color: #900;
}

.sg365-cid-label {
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
}

.sg365-cid-remaining {
    margin-top: 8px;
    color: #666;
    font-size: 0.95em;
}

.sg365-cid-history td,
.sg365-cid-history th {
    padding: 8px;
}

/* ------------------ Responsive ------------------ */
@media (max-width:800px) {
    .sg365-cid-wrap {
        padding: 10px;
    }
}

/* ------------------ New AJAX Form ------------------ */
#sg365-cid-limit-ajax {
    max-width: 720px;
    margin: 20px auto;
    font-family: Arial, sans-serif;
}

#sg365-cid-limit-ajax form {
    border: 1px solid #eaeaea;
    padding: 15px;
    background: #fafafa;
    border-radius: 6px;
    margin-bottom: 15px;
}

#sg365-cid-limit-ajax input[type="text"],
#sg365-cid-limit-ajax input[type="email"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    margin-bottom: 10px;
}

#sg365-cid-limit-ajax button {
    background-color: var(--sg365-btn-color, #0071a1);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

#sg365-cid-limit-ajax button:hover {
    background-color: #005f80;
}

/* ------------------ New CID Limits Table ------------------ */
#sg365-cid-limit-ajax table,
.woocommerce-account .sg365-cid-wrap table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.95em;
}

#sg365-cid-limit-ajax th,
#sg365-cid-limit-ajax td,
.woocommerce-account .sg365-cid-wrap th,
.woocommerce-account .sg365-cid-wrap td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

#sg365-cid-limit-ajax th,
.woocommerce-account .sg365-cid-wrap th {
    background: #f5f5f5;
    font-weight: 600;
}

#sg365-cid-limit-ajax tbody tr:nth-child(even),
.woocommerce-account .sg365-cid-wrap tbody tr:nth-child(even) {
    background: #fafafa;
}

#sg365-cid-limit-ajax tbody tr:hover,
.woocommerce-account .sg365-cid-wrap tbody tr:hover {
    background: #f1f1f1;
}

/* ------------------ Messages ------------------ */
#sg365-cid-limit-result p {
    padding: 10px;
    border-radius: 4px;
    margin-top: 8px;
}

#sg365-cid-limit-result p.error {
    background: #fff5f5;
    border: 1px solid #ffd4d4;
    color: #900;
}

#sg365-cid-limit-result p.success {
    background: #f0fff0;
    border: 1px solid #b3e6b3;
    color: #060;
}

.sg365-check-limit,
.sg365-admin-hero {
    color: #0f172a;
    padding: 18px;
    border-radius: 14px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.08);
}

.sg365-admin-hero h1,
.sg365-admin-hero p { color: inherit; }
.sg365-admin-hero .sg365-admin-card {
    display:flex;
    gap:14px;
    align-items:center;
    background: rgba(255,255,255,0.55);
    padding:12px 14px;
    border-radius:10px;
}
.sg365-admin-hero .sg365-admin-card strong { font-size:18px; }

.sg365-license-snapshot {
    display:grid;
    grid-template-columns: repeat(auto-fit,minmax(220px,1fr));
    gap:12px;
}
.sg365-license-snapshot .sg365-card {
    background:#0b1324;
    color:#e5edff;
    padding:14px;
    border-radius:12px;
    border:1px solid rgba(255,255,255,0.08);
}

.sg365-quick-instructions {
    background:#f8fbff;
    border:1px solid #e3edff;
    padding:14px;
    border-radius:10px;
}
.sg365-quick-instructions strong { color:#0f172a; }

.sg365-check-limit form {
    display:grid;
    gap:12px;
}
.sg365-check-limit form input[type="email"],
.sg365-check-limit form input[type="text"] {
    width: 100%;
    border-radius: 10px;
    padding: 12px;
    border: 1px solid #d7deff;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}
.sg365-check-limit .sg365-check-limit-btn {
    width: 100%;
    background: var(--sg365-btn-color, #2271b1) !important;
    border-color: var(--sg365-btn-color, #2271b1) !important;
    color:#fff !important;
    padding: 12px;
    font-weight:700;
    border-radius: 12px;
}
.sg365-check-limit-result {
    margin-top: 12px;
}
.sg365-check-limit-result .sg365-limit-table {
    width:100%;
    border-collapse: collapse;
    font-size: 0.95em;
}
.sg365-check-limit-result .sg365-limit-table th,
.sg365-check-limit-result .sg365-limit-table td {
    padding: 10px;
    border:1px solid #e5e7eb;
}
.sg365-check-limit-result .sg365-limit-table th { background:#f1f5f9; }
.sg365-check-limit-result .sg365-limit-table .sg365-remaining,
.sg365-limit-table .sg365-remaining { color:#0f7d31; font-weight:700; }

@media (max-width:600px){
    .sg365-check-limit-result .sg365-limit-table thead { display:none; }
    .sg365-check-limit-result .sg365-limit-table tr { display:block; padding:10px; }
    .sg365-check-limit-result .sg365-limit-table td { display:flex; justify-content:space-between; position:relative; }
    .sg365-check-limit-result .sg365-limit-table td::before { content: attr(data-label); font-weight:700; color:#444; padding-right:10px; }
}

.sg365-captcha-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0;
}

.sg365-reload-captcha {
    width: auto;
    padding: 0;
    margin-left: 8px;
    height: auto;
    background: none !important;
    border: none !important;
    font-size: 18px;
    cursor: pointer;
}

.sg365-form-layouts .sg365-layout-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin: 10px 0;
}

.sg365-form-layouts .sg365-layout-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}

.sg365-form-layouts .sg365-layout-label {
    font-weight: 600;
}

.sg365-captcha-notice {
    color: #a00;
    font-size: 0.95em;
}

.sg365-cid-locked {
    border: 1px solid #e5e5e5;
    background: #fafafa;
    padding: 15px;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
}

/* ------------------ Admin Table Safe ------------------ */
.wp-admin .widefat.sg365-cid-history,
.wp-admin .widefat.sg365-cid-history th,
.wp-admin .widefat.sg365-cid-history td {
    border: 1px solid #ddd;
    padding: 6px;
    font-size: 0.9em;
}

.sg365-table-responsive {
    overflow-x: auto;
}

@media (max-width: 782px) {
    .sg365-table-responsive table.widefat {
        display: block;
    }
    .sg365-table-responsive thead {
        display: none;
    }
    .sg365-table-responsive tr {
        display: block;
        border: 1px solid #e5e5e5;
        margin-bottom: 10px;
        padding: 8px;
    }
    .sg365-table-responsive td {
        display: flex;
        justify-content: space-between;
        gap: 8px;
        border: none !important;
        padding: 6px 0;
    }
.sg365-table-responsive td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #444;
    }

.sg365-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.sg365-modal-inner {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    max-width: 480px;
    width: 100%;
    position: relative;
}
.sg365-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
}
}

@media (max-width:800px){
    #sg365-cid-limit-ajax table,
    .woocommerce-account .sg365-cid-wrap table {
        font-size: 0.9em;
    }
}
/* ------------------ General wrapper ------------------ */
.sg365-cid-wrap,
#sg365-cid-limit-ajax {
    max-width: 720px;
    margin: 30px auto;
    font-family: Arial, sans-serif;
    padding: 15px;
    box-sizing: border-box;
}

/* ------------------ Inputs ------------------ */
.sg365-cid-wrap input[type="text"],
.sg365-cid-wrap input[type="email"],
#sg365-cid-limit-ajax input[type="text"],
#sg365-cid-limit-ajax input[type="email"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    margin-bottom: 12px;
    font-size: 0.95em;
}

/* ------------------ Forms ------------------ */
.sg365-cid-wrap form,
#sg365-cid-limit-ajax form {
    background: #fdfdfd;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* ------------------ Buttons ------------------ */
.sg365-cid-wrap button,
#sg365-cid-limit-ajax button,
.sg365-admin-hero button,
.sg365-check-limit .button {
    background-color: var(--sg365-btn-color, #2271b1);
    border-color: var(--sg365-btn-color, #2271b1);
    color: #fff;
    border: none;
    padding: 12px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s, border-color 0.3s;
}

.sg365-cid-wrap button:hover,
#sg365-cid-limit-ajax button:hover,
.sg365-admin-hero button:hover,
.sg365-check-limit .button:hover {
    background-color: var(--sg365-btn-hover, #1c5f99);
    border-color: var(--sg365-btn-hover, #1c5f99);
}

/* ------------------ Tables ------------------ */
#sg365-cid-limit-ajax table,
.woocommerce-account .sg365-cid-wrap table,
.wp-admin .widefat.sg365-cid-history {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.95em;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* Table Headers */
#sg365-cid-limit-ajax th,
.woocommerce-account .sg365-cid-wrap th,
.wp-admin .widefat.sg365-cid-history th {
    background: #0071a1;
    color: #fff;
    font-weight: 600;
    padding: 12px 10px;
    text-align: left;
}

/* Table Cells */
#sg365-cid-limit-ajax td,
.woocommerce-account .sg365-cid-wrap td,
.wp-admin .widefat.sg365-cid-history td {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

/* Zebra Stripe */
#sg365-cid-limit-ajax tbody tr:nth-child(even),
.woocommerce-account .sg365-cid-wrap tbody tr:nth-child(even) {
    background: #f9f9f9;
}

/* Hover */
#sg365-cid-limit-ajax tbody tr:hover,
.woocommerce-account .sg365-cid-wrap tbody tr:hover {
    background: #e6f7ff;
}

/* Messages */
#sg365-cid-limit-result p {
    padding: 12px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 0.95em;
}

#sg365-cid-limit-result p.error {
    background: #fff5f5;
    border: 1px solid #ffd4d4;
    color: #900;
}

#sg365-cid-limit-result p.success {
    background: #f0fff0;
    border: 1px solid #b3e6b3;
    color: #060;
}

/* Center AJAX form */
#sg365-cid-limit-ajax {
    text-align: center;
}

#sg365-cid-limit-ajax form {
    display: inline-block;
    text-align: left;
    width: 100%;
    max-width: 400px;
}

.sg365-form-style-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:16px; margin-top:20px; }
.sg365-form-style-card { border:1px solid #ddd; border-radius:8px; padding:16px; background:#fff; box-shadow:0 2px 4px rgba(0,0,0,0.04); text-align:center; }
.sg365-form-style-card h3 { margin-top:0; }
.sg365-form-style-card button[disabled] { opacity:0.6; }
.sg365-form-style-controls { border:1px solid #e3e3e3; padding:12px; border-radius:8px; margin-top:16px; background:#fff; }
.sg365-style-grid-fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:14px; }
.sg365-sample-btn { border:none; color:#fff; padding:10px 16px; margin-bottom:10px; border-radius:6px; font-weight:700; cursor:default; }
.sg365-form-style-thumb { border:1px solid #eee; border-radius:6px; overflow:hidden; margin:10px auto; max-width:260px; background:#fafafa; }
.sg365-form-style-thumb img { width:100%; height:auto; display:block; }
.sg365-style-select { display:block; margin-top:8px; font-weight:600; }
.sg365-style-select input { margin-right:6px; }
.sg365-admin-search { display:flex; gap:10px; align-items:center; margin:10px 0; flex-wrap:wrap; }
.sg365-admin-search input[type="search"] { min-width: 260px; }

/* Front-end form style presets */
.sg365-style-1 { font-family: 'Poppins', Arial, sans-serif; }
.sg365-style-1 input { border-radius: 10px; border-color: #cbd5e0; box-shadow: inset 0 1px 3px rgba(0,0,0,0.08); }
.sg365-style-1 .sg365-cta-with-icon { background: linear-gradient(135deg,#2563eb,#1e40af); border: none; box-shadow: 0 8px 20px rgba(37,99,235,0.25); }
.sg365-style-1 .sg365-btn-icon { background:#fff; color:#2563eb; border-radius:50%; width:28px; height:28px; display:inline-flex; align-items:center; justify-content:center; }

.sg365-style-2 { font-family: 'Inter', Arial, sans-serif; }
.sg365-style-2 input { border-radius: 4px; border:1px solid #0ea5e9; background:#f0f9ff; }
.sg365-style-2 .sg365-cta-with-icon { background:#0ea5e9; border:none; letter-spacing:0.5px; }
.sg365-style-2 .sg365-btn-icon { font-size:18px; }

.sg365-style-3 { font-family: 'Montserrat', Arial, sans-serif; }
.sg365-style-3 input { border-radius: 0; border:2px solid #111827; }
.sg365-style-3 .sg365-cta-with-icon { background:#111827; color:#fff; text-transform:uppercase; border-radius:0; }
.sg365-style-3 .sg365-btn-icon { margin-right:2px; }

.sg365-style-4 { font-family: 'Nunito', Arial, sans-serif; }
.sg365-style-4 input { border-radius: 12px; border:1px solid #d53f8c; background:#fff0f6; }
.sg365-style-4 .sg365-cta-with-icon { background:#d53f8c; border:none; box-shadow: 0 6px 14px rgba(213,63,140,0.25); }
.sg365-style-4 .sg365-btn-icon { font-size:19px; }

.sg365-style-5 { font-family: 'Work Sans', Arial, sans-serif; }
.sg365-style-5 input { border-radius: 8px; border:1px solid #10b981; background:#ecfdf3; }
.sg365-style-5 .sg365-cta-with-icon { background:#10b981; border:none; box-shadow: 0 8px 18px rgba(16,185,129,0.25); }
.sg365-style-5 .sg365-btn-icon { font-size:18px; }

/* Responsive */
@media (max-width:800px){
    .sg365-cid-wrap,
    #sg365-cid-limit-ajax {
        padding: 10px;
    }

    #sg365-cid-limit-ajax table,
    .woocommerce-account .sg365-cid-wrap table {
        font-size: 0.9em;
    }

    .sg365-responsive-table,
    .sg365-responsive-table thead,
    .sg365-responsive-table tbody,
    .sg365-responsive-table th,
    .sg365-responsive-table td,
    .sg365-responsive-table tr {
        display: block;
    }
    .sg365-responsive-table thead { display: none; }
    .sg365-responsive-table tr { margin-bottom: 12px; border:1px solid #eee; padding:8px; border-radius:8px; }
    .sg365-responsive-table td { border: none; position: relative; padding-left: 50%; }
    .sg365-responsive-table td:before { position: absolute; left: 10px; top: 8px; width: 45%; white-space: nowrap; font-weight:600; content: attr(data-label); }
}
