﻿/* Sidebar for desktop */
#sidebar {
    display: block;
}

#editTextArea {
    min-height: 250px;
    min-width: 500px;
}

.sec-control-row {
    display: none;
}

#sidebar {
    display: block;
}

#mobile-sidebar {
    display: block;
}

.mobile-sidebar-toggle, .mobile-sidebar-header {
    display: none;
}
.swal2-container {
    z-index: 99999 !important;
}

@media screen and (max-width: 767px) and (orientation: portrait) {
    body {
      /*  background: lightblue;*/
    }

    #toolbar {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        justify-content: center;
        margin-right: 25px;
        padding: 6px !important;
    }

    #font-selector {
        width: 100px;
        height: 24px;
        padding: 3px 6px;
        border: 1px solid #e0e0e0;
        border-radius: 6px;
        font-size: 9px;
        background-color: #f8f9fa;
        color: #333333;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        cursor: pointer;
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }

    .font-size-input {
        padding: 4px;
        border: 1px solid #e0e0e0;
        font-size: 9px;
        border-radius: 6px;
        background: #f8f9fa;
        color: #333333;
        width: 40px;
        text-align: center;
    }

    .toolbar-button {
        padding: 2px 6px;
        font-size: 10px;
        height: 25px;
        width: 25px;
    }

        .toolbar-button i {
            font-size: 12px;
        }
    /* Collapse headings smaller */
    .control-group h3 {
        font-size: 12px;
    }
    /* Reduce side paddings */
    .condiv {
        padding: 5px !important;
    }

    #canvasContainer {
        width: 100% !important; /* Fit inside viewport width */
        height: auto !important; /* Maintain aspect ratio */
        aspect-ratio: 297 / 210;
        padding: 5px;
    }

    .btnwidth {
        width: 120px !important;
        height: 30px !important;
    }

        .btnwidth i {
            font-size: 14px !important;
        }

    .btn {
        font-size: 12px !important;
    }



    .mobile-sidebar-toggle {
        display: block;
        /*   position: relative; */
        top: 10px;
        left: 10px;
        /*  z-index: 2000; */
        background: #fff;
        border: 1px solid #ccc;
        border-radius: 6px;
        padding: 8px 12px;
        cursor: pointer;
    }

    #sidebar {
        display: block;
        width: 0 !important;
    }



    #mobile-sidebar {
        display: block;
        position: fixed;
        top: 0;
        right: -250px;
        width: 250px;
        height: 100vh;
        background: #fff;
        box-shadow: -2px 0 6px rgba(0,0,0,0.2);
        transition: right 0.3s ease;
        z-index: 1079;
        padding: 15px;
        overflow-y: auto;
    }

        #mobile-sidebar.active {
            right: 0; /* Slide in */
        }

    .mobile-sidebar-header {
        display: flex;
        justify-content: flex-end;
    }

    .mobile-sidebar-close {
        background: none;
        border: none;
        font-size: 24px;
        cursor: pointer;
    }
    /* Overlay (covers the screen when sidebar is open) */
    #mobile-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.3);
        z-index: 1078;
    }
    /* Show overlay when active */
    #mobile-sidebar.active + #mobile-sidebar-overlay {
        display: block;
    }

    #editTextArea {
        min-height: 250px;
        min-width: 300px !important;
    }

    .table-container {
        max-height: 60vh;
        overflow-x: auto;
        overflow-y: auto;
        resize: both;
        max-width: 100%;
        min-height: 35vh;
        min-width: 300px;
    }

    [data-pc-direction=rtl] .condiv {
        position: relative;
        right: -10px !important;
    }

    #phraseList .phrase-item {
        font-size: 12px !important;
    }

    .addnewcontrols {
        height: auto;
    }

    .preview-img-cert-container, .preview-cert-img {
        display: none !important;
    }



    .dropdown-content {
        display: none;
        position: absolute;
        background-color: white;
        min-width: 120px;
        border: 1px solid #e0e0e0;
        box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        padding: 4px;
        border-radius: 6px;
        top: 100%;
        margin-top: 8px;

         left: auto; 
        right: 0;
        transform: translateX(70px);
        max-width: 150px;
        overflow-wrap: break-word;
    }
    .toolbar-range  {
        gap:1px !important;
    }
    .toolbar-range input[type="range"] {
        width: 80px;
        cursor: pointer;
    }
    .toolbar-range label {
        font-size: 11px;
    }

    .dropdown-content li {
        padding: 6px 6px;
        cursor: pointer;
        color: #333333;
        font-size: 12px;
        border-radius: 4px;
        transition: background 0.2s ease;
    }

    .icon {
        width: 15px;
        height: 15px;
    }

    .controls-container {
        margin-bottom: 50px !important;
        padding-bottom: 50px !important;
        height: auto !important;
    }

    .main-row {
        justify-content: center !important;
        min-height: 500px;
        /* padding-top:10px; */
    }

    .main-control-row {
        display: block;
    }

    .sec-control-row {
        display: none;
    }

    .canvas-col {
        width: 100% !important;
    }

    main {
        padding-top: 10px;
        padding-right: 10px !important;
        padding-left: 10px !important;
    }

    .pc-content {
        margin-right: 0px !important;
    }






    .context-menu.toolbar-style {
        display: none;
        position: absolute;
        top: 120px !important;
        background-color: #fff;
        border: 1px solid #d4d4d4;
        border-radius: 6px;
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
        z-index: 1000;
        padding: 6px;
        width: auto;
        font-family: 'Segoe UI', sans-serif;
        min-width: 150px;
        max-height: 250px;
        overflow-y: auto;
    }

        .context-menu.toolbar-style li {
            position: relative;
            display: block;
            padding: 4px 6px;
            cursor: pointer;
            font-size: 11px;
            text-align: right;
            border-radius: 4px;
            background-color: #fff;
            transition: background-color 0.2s ease-in-out;
        }

            .context-menu.toolbar-style li.dropdown ul {
                display: none;
                position: fixed;
                top: auto;
                background-color: #fff;
                padding: 5px 5px;
                border-radius: 6px;
                box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
                min-width: 150px;
                max-width: 200px;
                border: 1px solid #d4d4d4;
                max-height: 180px;
                overflow-y: auto;
                z-index: 1100;
                margin: 5px;

                left: 5; /* default anchor */
                right: auto; /* reset */
                transform: translateX(0);
                max-width: calc(100vw - 24px); /* prevent overflow */
                overflow-wrap: break-word;
            }

    .background-item-cert .img-cert {
       
        -webkit-touch-callout: none; /* Disable callout (long-press menu) */
        -webkit-user-select: none; /* Disable text/image selection */
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        pointer-events: auto; /* still allow click */
    }
}


@media screen and (max-width: 932px) and (orientation: landscape) {
    body {
        /* background: lightgreen;*/ /* Example */
    }

    #toolbar {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        justify-content: center;
        margin-right: 0px;
        padding: 6px !important;
    }

    #font-selector {
        width: 100px;
        height: 24px;
        padding: 3px 6px;
        border: 1px solid #e0e0e0;
        border-radius: 6px;
        font-size: 9px;
        background-color: #f8f9fa;
        color: #333333;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        cursor: pointer;
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }

    .font-toolbar::after {
        content: "▼";
        position: absolute;
        top: 50%;
        left: 8px;
        transform: translateY(-50%);
        pointer-events: none;
        font-size: 12px;
        color: #666666;
    }

    .font-size-input {
        padding: 4px;
        border: 1px solid #e0e0e0;
        font-size: 9px;
        border-radius: 6px;
        background: #f8f9fa;
        color: #333333;
        width: 40px;
        text-align: center;
    }

    .toolbar-button {
        padding: 2px 6px;
        font-size: 10px;
        height: 25px;
        width: 25px;
    }


        .toolbar-button i {
            font-size: 12px;
        }
    /* Collapse headings smaller */
    .control-group h3 {
        font-size: 12px;
    }
    /* Reduce side paddings */
    .condiv {
        padding: 5px !important;
        right: 0px !important;
    }

    #canvasContainer {
        width: 85% !important; /* Fit inside viewport width */
        height: auto !important; /* Maintain aspect ratio */
        aspect-ratio: 297 / 210;
        padding: 5px;
        margin: 0 auto;
    }

    .btnwidth {
        width: 120px !important;
        height: 30px !important;
    }

        .btnwidth i {
            font-size: 14px !important;
        }

    .btn {
        font-size: 12px !important;
    }




    .mobile-sidebar-toggle {
        display: block;
        /*   position: relative; */
        top: 10px;
        left: 10px;
        background: #fff;
        border: 1px solid #ccc;
        border-radius: 6px;
        padding: 8px 12px;
        cursor: pointer;
    }

    #sidebar {
        display: block;
        width: 0 !important;
    }


    #mobile-sidebar {
        display: block;
        position: fixed;
        top: 0;
        right: -250px;
        width: 250px;
        height: 100vh;
        background: #fff;
        box-shadow: -2px 0 6px rgba(0,0,0,0.2);
        transition: right 0.3s ease;
        z-index: 1079;
        padding: 15px;
        overflow-y: auto;
    }

        #mobile-sidebar.active {
            right: 0; /* Slide in */
        }

    .mobile-sidebar-header {
        display: flex;
        justify-content: flex-end;
    }

    .mobile-sidebar-close {
        background: none;
        border: none;
        font-size: 24px;
        cursor: pointer;
    }
    /* Overlay (covers the screen when sidebar is open) */
    #mobile-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.3);
        z-index: 1078;
    }
    /* Show overlay when active */
    #mobile-sidebar.active + #mobile-sidebar-overlay {
        display: block;
    }

    #editTextArea {
        min-height: 250px;
        min-width: 300px !important;
    }

    .table-container {
        max-height: 60vh;
        overflow-x: auto;
        overflow-y: auto;
        resize: both;
        max-width: 100%;
        min-height: 35vh;
        min-width: 300px;
    }

    [data-pc-direction=rtl] .condiv {
        position: relative;
        right: 0px !important;
    }

    #phraseList .phrase-item {
        font-size: 12px !important;
    }

    .addnewcontrols {
        height: auto;
    }


    .dropdown-content {
        display: none;
        position: absolute;
        background-color: white;
        min-width: 120px;
        border: 1px solid #e0e0e0;
        box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        padding: 4px;
        border-radius: 6px;
        top: 100%;
        margin-top: 8px;
    }

        .dropdown-content li {
            padding: 4px 6px;
            cursor: pointer;
            color: #333333;
            font-size: 12px;
            border-radius: 4px;
            transition: background 0.2s ease;
        }

    .icon {
        width: 15px;
        height: 15px;
    }

    .controls-container {
        margin-bottom: 50px !important;
        padding-bottom: 50px !important;
        height: auto !important;
    }

    .main-row {
        justify-content: center !important;
        min-height: 500px;
        /* padding-top:10px; */
    }



    .main-control-row {
        display: none;
    }



    .sec-control-row {
        padding-top: 5px;
        display: block;
        width: 40% !important;
    }

    .canvas-col {
        width: 60% !important;
        /* display: grid;*/
        justify-items: center; /* only horizontal centering */
        height: auto;
    }

    .background-item-cert .img-cert {
        width: 160px;
        height: 100px;

        -webkit-touch-callout: none; /* Disable callout (long-press menu) */
        -webkit-user-select: none; /* Disable text/image selection */
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        pointer-events: auto; /* still allow click */
    }



    #preview-cert-img {
        width: 80% !important;
        height: auto !important;
        aspect-ratio: 297 / 210;
        pointer-events: none !important;
    }

    main {
        padding-top: 10px;
        padding-right: 10px !important;
        padding-left: 10px !important;
    }

    .pc-content {
        margin-right: 0px !important;
    }


    .pc-header {
        min-height: 50px !important;
        height: 60px !important;
    }

    #preview-img-cert-container {
        width: 70% !important;
    }

    #Main-preview-container .row {
        /* flex-shrink: 0; */
        width: auto;
        max-width: none;
    }

    #Main-preview-container .col-md-3 {
        width: 30% !important;
    }





    .context-menu.toolbar-style {
        display: none;
        position: absolute;
        top: 80px!important;
        background-color: #fff;
        border: 1px solid #d4d4d4;
        border-radius: 6px;
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
        z-index: 1000;
        padding: 6px;
        width: auto;
        font-family: 'Segoe UI', sans-serif;
        min-width: 150px;
        max-height: 250px;
        overflow-y: auto;
    }

        .context-menu.toolbar-style li {
            position: relative;
            display: block;
            padding: 4px 6px;
            cursor: pointer;
            font-size: 11px;
            text-align: right;
            border-radius: 4px;
            background-color: #fff;
            transition: background-color 0.2s ease-in-out;
        }

            .context-menu.toolbar-style li.dropdown ul {
                display: none;
                position: absolute;
                top: auto;
                left: auto;
                right: auto;
                background-color: #fff;
                padding: 5px 5px;
                border-radius: 6px;
                box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
                min-width: 150px;
                max-width: 200px;
                border: 1px solid #d4d4d4;
                max-height: 180px;
                overflow-y: auto;
                z-index: 1100;
                margin: 5px;
            }
    .preview-img-cert-controls {
        /* background-color: #ffffff; */
        
        height: auto !important;
        margin-bottom: 20px;
       max-height: 100% !important; 
    }
}