/* ============================================================
   Swifty Signature Generator — Responsive Styles
   ============================================================ */

/* ----------------------------------------------------------
   Desktop: hide mobile toggle (min-width keeps it out of
   the way of all mobile media queries below)
   ---------------------------------------------------------- */
@media screen and (min-width: 993px) {
    .mobile-panel-toggle {
        display: none !important;
    }
}


/* ----------------------------------------------------------
   Tablet & below  (max-width 992px)
   The split-panel becomes a stacked single-column layout
   with a toggle button to switch between form and preview.
   ---------------------------------------------------------- */
@media screen and (max-width: 992px) {

    /* ---- Layout: stack form above preview ---- */
    .container.page-wrap {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .page-wrap {
        height: auto;
    }

    .left-side-bar {
        width: 100%;
        height: auto;
        overflow: visible;
        position: relative;
    }

    /* Override the original rule that hides the form off-screen */
    .signature-form {
        position: relative !important;
        left: 0 !important;
        width: 100% !important;
        height: auto !important;
        padding-top: 120px;
        transition: none;
    }

    /* Branding bar: full-width fixed at top */
    .swifty-branding {
        width: 100%;
        position: fixed;
        z-index: 100;
    }

    /* Tab bar: full-width */
    body .signature-form .acf-tab-wrap {
        max-width: 100%;
        width: 100%;
    }

    /* Scrollable field area */
    body .signature-form .acf-fields {
        height: auto;
        overflow: visible;
        padding-bottom: 20px;
    }

    body .signature-form form#acf-form {
        min-height: auto;
        padding-bottom: 20px;
    }

    /* ---- Preview panel ---- */
    .signature-preview {
        width: 100% !important;
        height: auto !important;
        overflow: visible;
        padding: 20px 0 40px;
    }

    .sg-preview-window {
        width: 95% !important;
        max-width: 100%;
    }

    .sg-window-body {
        padding: 30px 15px;
    }

    .branding-header {
        width: 95%;
        padding-bottom: 15px;
    }

    /* ---- Mobile toggle button ---- */
    .mobile-panel-toggle {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        z-index: 200;
        background: #231f20;
        padding: 0;
        margin: 0;
        border: none;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
    }

    .mobile-panel-toggle button {
        flex: 1;
        background: #565656;
        color: #fff;
        border: none;
        padding: 14px 10px;
        font-size: 15px;
        font-weight: 700;
        font-family: urw-din, sans-serif;
        cursor: pointer;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        transition: background 0.2s;
    }

    .mobile-panel-toggle button.active {
        background: #00AEEF;
    }

    .mobile-panel-toggle button:not(:last-child) {
        border-right: 1px solid #231f20;
    }

    /* Panel visibility states controlled by JS via body class */
    body.show-preview .left-side-bar {
        display: none !important;
    }

    body.show-preview .signature-preview {
        display: block !important;
    }

    body.show-form .left-side-bar {
        display: block !important;
    }

    body.show-form .signature-preview {
        display: none !important;
    }

    /* Extra bottom padding so content is not hidden behind toggle bar */
    body.show-form .signature-form,
    body.show-preview .signature-preview {
        padding-bottom: 70px !important;
    }

    /* Responsive buttons row: hide desktop/mobile preview toggle on mobile */
    .responsive_buttons_demo {
        display: none !important;
    }

    /* Signature table overflow prevention */
    .sg-window-body-inner {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sg-template {
        min-width: auto !important;
    }
}


/* ----------------------------------------------------------
   Small phones  (max-width 600px)
   ---------------------------------------------------------- */
@media screen and (max-width: 600px) {

    .swifty-branding {
        height: 80px;
        padding: 8px 0;
    }

    .swifty-branding img {
        max-width: 140px;
    }

    .signature-form {
        padding-top: 90px !important;
    }

    body .signature-form .acf-tab-wrap ul.acf-hl li > a {
        padding: 12px 6px;
        font-size: 12px;
    }

    body .signature-form .acf-fields > .acf-field:not(.acf-field--post-title) {
        padding: 15px 5px;
    }

    body .signature-form .acf-fields {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Template selection thumbnails */
    .acf-field[data-name="select_your_template"] ul.acf-radio-list > li label {
        max-width: 100%;
        height: 120px;
        margin-bottom: 40px;
    }

    span.template-label {
        margin-top: -40px;
        font-size: 13px;
    }

    /* Color picker */
    .signature-form .acf-input > .acf-color-picker .wp-picker-input-wrap:not(.hidden) {
        width: calc(100% - 50px);
    }

    .signature-form .acf-input > .acf-color-picker .wp-picker-input-wrap input {
        width: 100px;
        font-size: 15px;
    }

    /* Signature preview */
    .sg-window-body {
        padding: 20px 10px;
    }

    .sg-window-meta {
        padding: 10px 15px;
    }

    .sg-window-meta p.meta-text {
        font-size: 13px;
    }

    /* Signature popup (generated signature) */
    .wrapper {
        padding: 30px 10px;
    }

    h1.signature-popup-title {
        font-size: 22px;
        line-height: 1.3;
    }

    h2.signature-popup-subtitle {
        font-size: 14px;
        line-height: 1.5;
    }

    .generated-signature-wrapper {
        padding: 20px 10px;
        margin: 30px auto;
    }

    .signature-actions {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .signature-action {
        margin: 0;
        width: 100%;
        max-width: 300px;
        font-size: 15px;
        padding: 16px 20px;
    }

    .generated-signature-source {
        padding: 20px 10px;
        margin: 30px auto;
    }

    .generated-signature-source textarea {
        font-size: 12px;
        min-height: 160px;
    }

    a.generate-signature {
        font-size: 16px;
        padding: 14px 24px;
        width: auto;
        max-width: 90%;
    }

    a.return-to-editor {
        font-size: 15px;
    }

    /* Swifty user buttons (when accessed from Swifty portal) */
    .swifty-user-buttons {
        width: 100%;
        text-align: center;
    }

    a.su-button {
        font-size: 16px;
        line-height: 50px;
        min-width: 100px;
        padding: 0 15px;
    }

    .signature-preview.swifty-user-active .branding-header {
        height: auto;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        padding: 10px;
    }
}


/* ----------------------------------------------------------
   Splash page responsive
   ---------------------------------------------------------- */
@media screen and (max-width: 768px) {

    .splash-page-container {
        flex-direction: column;
        padding: 30px 20px 0;
    }

    .splash-hero-left {
        width: 100%;
        padding-left: 0;
        text-align: center;
    }

    .splash-hero-left h1 {
        font-size: 28px;
    }

    .splash-hero-left p {
        font-size: 18px;
        max-width: 100%;
    }

    .splash-hero-left img {
        width: 200px;
    }

    .splash-hero-right {
        width: 100%;
        min-height: 300px;
    }

    img.email-mockup {
        max-width: 100%;
        position: relative;
    }

    .hexagon-shapes {
        display: none;
    }

    .splash-page:after {
        height: 80px;
    }
}


/* ----------------------------------------------------------
   Tracking page responsive
   ---------------------------------------------------------- */
@media screen and (max-width: 600px) {

    .tracking.stats {
        padding: 30px 15px;
    }

    .tracking.stats h1 {
        font-size: 22px;
    }

    .tracking.stats h1 select.signature-tracking-range {
        font-size: 22px;
    }
}
