.adsbygoogle {
    display: block !important;
    width: 100% !important;
    /* border : 10px solid orange; */
}

.toolbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #ccc;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.toolbar.hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    position: absolute;
    width: 100%;
}

.toolbar-toggle {
    display: flex;
    justify-content: center;
    padding: 4px 0;
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid #ccc;
    z-index: 999;
}

.toolbar-toggle button {
    background: #2b3faa;
    color: white;
    border: none;
    border-radius: 30px;
    padding: 6px 16px;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    min-height: 36px;
}

.toolbar-toggle button:hover {
    background: #3f5eb5;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f0f2f5;
    padding: 4px 8px;
    border-radius: 30px;
    border: 1px solid #d0d5e0;
    flex-wrap: wrap;
}

button {
    background: white;
    border: 1px solid #ccd3e0;
    padding: 8px 12px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
    color: #1e293b;
    min-height: 44px;
    min-width: 44px;
    justify-content: center;
    position: relative;
}

button[data-tooltip] {
    position: relative;
}

button[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 2000;
    pointer-events: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid #334155;
    font-weight: normal;
}

button[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #1e293b;
    z-index: 2000;
}

button:hover {
    background: #e8ecf5;
    border-color: #9aa8c9;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

button.active {
    background: #d1dcfc;
    border-color: #3f5eb5;
    color: #1a2b6b;
}

#btnText.active {
    background: #d1dcfc;
    border-color: #3f5eb5;
}

.color-picker-group {
    display: flex;
    align-items: center;
    gap: 4px;
    background: white;
    padding: 4px 8px;
    border-radius: 30px;
    border: 1px solid #ccd3e0;
    min-height: 44px;
}

.color-picker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.color-picker-item label {
    font-size: 10px;
    color: #64748b;
}

.color-picker-item input[type="color"] {
    width: 36px;
    height: 30px;
    border: 2px solid white;
    border-radius: 20px;
    cursor: pointer;
    padding: 2px;
}

.opacity-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 4px 12px;
    border-radius: 30px;
    border: 1px solid #ccd3e0;
    min-height: 44px;
}

.opacity-control label {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
}

.opacity-control input[type="range"] {
    width: 80px;
    cursor: pointer;
}

.opacity-control span {
    font-size: 12px;
    color: #1e293b;
    min-width: 35px;
    text-align: right;
}

.text-styling-panel {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 4px 12px;
    border-radius: 30px;
    border: 1px solid #ccd3e0;
    min-height: 44px;
    flex-wrap: wrap;
}

.text-styling-panel select,
.text-styling-panel input[type="number"] {
    padding: 4px 8px;
    border-radius: 20px;
    border: 1px solid #ccd3e0;
    font-size: 12px;
    min-height: 30px;
    background: white;
}

.text-styling-panel input[type="number"] {
    width: 60px;
    text-align: center;
}

.text-styling-panel button {
    min-height: 30px;
    min-width: 30px;
    padding: 4px 8px;
    background: #f8fafc;
}

.text-styling-panel button.active {
    background: #d1dcfc;
    border-color: #3f5eb5;
}

.text-help-panel {
    background: #2b3faa;
    color: white;
    padding: 10px 16px;
    border-radius: 30px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    margin: 8px 12px;
    justify-content: center;
    border: 1px solid #4f6eb3;
}

.text-help-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.text-help-key {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 16px;
    font-family: monospace;
    font-size: 11px;
    font-weight: bold;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.text-help-desc {
    font-size: 12px;
}

.main-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.canvas-row {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

#canvasContainer {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #f5f7fc;
    background-image:
        linear-gradient(#e1e6f0 1px, transparent 1px),
        linear-gradient(90deg, #e1e6f0 1px, transparent 1px);
    background-size: 40px 40px;
    touch-action: none;
}

#canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    /* height: 100%; */
    display: block;
    cursor: grab;
    touch-action: none;
}

#canvas.panning {
    cursor: grabbing;
}

.ad-container {
    width: 250px;
    background: #ffffff;
    border-left: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 8px;
    gap: 16px;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.05);
}

.ad-label {
    font-size: 10px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.ad-space {
    width: 100%;
    min-height: 600px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 8px;
    color: #64748b;
    font-size: 12px;
    text-align: center;
}

.ad-space small {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 8px;
}

.ad-bottom {
    display: none;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 8px;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.ad-bottom .ad-space {
    display: inline-block;
    width: 300px;
    min-height: 80px;
    margin-right: 8px;
    vertical-align: top;
}

#btnDownload {
    background: #2b3faa;
    color: white;
    border-color: #1a2b6b;
}

#btnDownload:hover {
    background: #3f5eb5;
}

@media (max-width: 768px) {
    .ad-container {
        display: none;
    }

    .ad-bottom {
        display: flex;
        justify-content: center;
    }
}

.status-bar {
    background: rgba(0, 0, 0, 0.05);
    padding: 8px 16px;
    font-size: 12px;
    color: #4a5568;
    border-top: 1px solid #ccc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.selection-count {
    background: #2b3faa;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
}

.shortcuts-hint {
    color: #2b3faa;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 20px;
    background: rgba(43, 63, 170, 0.1);
}

.shortcuts-hint:hover {
    background: rgba(43, 63, 170, 0.2);
}

#text-editor-input {
    position: absolute;
    background: white;
    border: 2px solid #2b3faa;
    outline: none;
    padding: 8px 12px;
    font-family: Arial, sans-serif;
    resize: both;
    overflow: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    z-index: 10000;
    display: none;
    line-height: 1.5;
    min-width: 200px;
    min-height: 60px;
    caret-color: #2b3faa;
    transition: box-shadow 0.2s ease;
}

#text-editor-input:focus {
    box-shadow: 0 8px 25px rgba(43, 63, 170, 0.25);
    border-color: #1a2b6b;
}

.reposition-icon {
    position: absolute;
    width: 28px;
    height: 28px;
    background: #2b3faa;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    cursor: move;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid white;
    z-index: 9000;
    pointer-events: all;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    transform: translate(-50%, -50%);
}

.reposition-icon:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(43, 63, 170, 0.4);
    background: #3f5eb5;
}

.reposition-icon.dragging {
    transform: translate(-50%, -50%) scale(0.95);
    opacity: 0.9;
    cursor: grabbing;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 24px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 20px;
    color: #1e293b;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
    min-width: auto;
    padding: 8px;
}

.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: #f8fafc;
    border-radius: 12px;
}

.shortcut-key {
    background: white;
    border: 1px solid #cbd5e1;
    padding: 4px 8px;
    border-radius: 6px;
    font-family: monospace;
    font-weight: 600;
    color: #2b3faa;
    min-width: 60px;
    text-align: center;
}

.shortcut-desc {
    color: #334155;
}

@media (max-width: 768px) {
    .main-content{
        height: 100vh;
    }

    .toolbar {
        padding: 4px 8px;
    }

    .tool-group {
        padding: 2px 4px;
    }

    button {
        padding: 6px 8px;
        font-size: 13px;
        min-height: 40px;
        min-width: 40px;
    }

    .color-picker-group {
        min-height: 40px;
        padding: 2px 8px;
    }

    .color-picker-item input[type="color"] {
        width: 32px;
        height: 28px;
    }

    .opacity-control {
        min-height: 40px;
        padding: 2px 8px;
    }

    .opacity-control input[type="range"] {
        width: 60px;
    }

    .text-styling-panel {
        min-height: 40px;
        padding: 2px 8px;
    }

    .text-help-panel {
        padding: 8px 12px;
        gap: 12px;
        font-size: 11px;
    }

    .text-help-key {
        padding: 2px 8px;
    }

    .status-bar {
        padding: 4px 8px;
        font-size: 11px;
    }

    .shortcut-key {
        min-width: 50px;
        font-size: 11px;
    }

    button[data-tooltip]:hover::after {
        font-size: 10px;
        padding: 4px 8px;
        bottom: -25px;
    }

    .reposition-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}