/* CalliDraw Tool Styles */

/* Main container */
#callidraw-container {
    background-color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    margin-bottom: 50px;
}

#callidraw-container h1 {
    color: #000;
    text-align: center;
    padding: 10px 0;
    margin: 20px auto;
    margin-top: 1px;
    background-color: #fff;
}

/* Text elements */
.callidraw-text-element {
    cursor: move;
    user-select: none;
}

/* Canvas container */
#callidraw-canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px auto;
    margin-top: 50px;
    border: 1px solid #ccc;
    background-color: #fff;
    width: 80vw;
    height: 70vh;
    max-width: 1200px;
}

#callidraw-svgCanvas {
    background-color: #fff;
    cursor: crosshair;
    width: 100%;
    height: 100%;
}

/* SVG elements */
.callidraw-control-point {
    fill: #ff5722;
    stroke: #fff;
    stroke-width: 2px;
    cursor: pointer;
}

.callidraw-curve-control-point {
    fill: #4CAF50;
    stroke: #fff;
    stroke-width: 2px;
    cursor: pointer;
}

.callidraw-midpoint {
    fill: #888;
    stroke: #fff;
    stroke-width: 1px;
    cursor: pointer;
}

.callidraw-line {
    fill: none;
    stroke: #3654b7;
    stroke-width: 2px;
    cursor: pointer;
}

.callidraw-grid-line {
    stroke: #e0e0e0;
    stroke-width: 1;
}

.callidraw-axis-line {
    stroke: #3654b7;
    stroke-width: 1.5;
}

.callidraw-axis-label {
    fill: #000;
    font-size: 14px;
    max-width: 1200px;
}

.callidraw-full-path {
    stroke: #000;
    stroke-width: 2;
    fill: none;
    pointer-events: visiblePainted;
    cursor: pointer;
    z-index: 10;
}

.callidraw-segment-line {
    fill: none;
    stroke: #3654b7;
    stroke-width: 2px;
    cursor: pointer;
}

.callidraw-full-path > title {
    display: none;
}

.callidraw-text-element {
    font-family: Arial, sans-serif !important;
    cursor: move;
    user-select: none;
    dominant-baseline: hanging;
}

/* Ensure SVG text elements in CalliDraw canvas use their attributes */
#callidraw-canvas text.callidraw-text-element {
    font-family: Arial, sans-serif !important;
}

/* Controls */
#callidraw-controls {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    margin: 0 auto;
    max-width: 1200px;
    padding: 10px 0;
    border: 1px solid #ccc;
    background-color: #fff;
    width: 80vw;
}

.callidraw-control-row {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    margin: 5px 0;
}

.callidraw-left-controls,
.callidraw-right-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.callidraw-left-controls > * {
    margin: 5px 10px;
}

.callidraw-right-controls {
    margin-right: auto;
}

/* Background controls */
#callidraw-bg-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: left;
    border: 1px solid #ccc;
    padding: 5px 5px;
    margin: 8px;
    background-color: #f5f5f5;
    justify-content: space-between;
}

#callidraw-bg-controls > * {
    margin: 1px 10px;
}

/* Form elements */
#callidraw-controls label {
    font-size: 16px;
    display: flex;
    align-items: center;
    margin: 5px 20px;
    gap: 10px;
}

#callidraw-controls input[type='checkbox'] {
    margin: 5px;
    transform: scale(1.2);
}

#callidraw-controls button,
#callidraw-controls input[type='number'],
#callidraw-controls input[type='color'] {
    padding: 10px 15px;
    font-size: 16px;
    border: none;
    border-radius: 4px;
    margin-right: 1px;
    margin-left: 8px;
}

#callidraw-controls button {
    background-color: #29439b;
    color: #fff;
    cursor: pointer;
}

#callidraw-controls button:hover {
    background-color: #18285f;
}

#callidraw-controls button.active {
    background-color: #3da441;
}

/* Line controls */
.callidraw-line-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    margin-left: 20px;
}

.callidraw-line-controls > label {
    margin-right: 20px;
}

/* Information area */
#callidraw-information {
    margin: 20px auto;
    max-width: 1200px;
    padding: 10px;
    border: 1px solid #ccc;
    margin-bottom: 10px;
    background-color: #fcfcfc;
    width: 80vw;
}

#callidraw-information h3 {
    margin: 0;
    font-size: 18px;
    display: inline-block;
    float: left;
}

#callidraw-information-content {
    display: flex;
    gap: 30px;
    align-items: center;
    flex-wrap: wrap;
}

#callidraw-information-content p {
    margin: 0px 5px 0px 100px;
}

#callidraw-message {
    color: green;
    margin-top: 10px;
    text-align: center;
}

/* Path data area */
#callidraw-pathData {
    margin: 20px auto;
    max-width: 1200px;
    padding: 10px;
    border: 1px solid #ccc;
    margin-bottom: 10px;
    background-color: #fcfcfc;
    width: 80vw;
}

#callidraw-pathData h3 {
    margin: 0;
    font-size: 18px;
    display: inline-block;
    float: left;
}

#callidraw-copyCodeBtn {
    float: right;
    background-color: #29439b;
    color: #fff;
    margin-right: 25px;
    cursor: pointer;
    padding: 10px 15px;
    font-size: 16px;
    border: none;
    border-radius: 4px;
}

#callidraw-pathData textarea {
    width: 98%;
    height: 150px;
    font-family: monospace;
    font-size: 14px;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
    resize: vertical;
    margin-top: 10px;
    margin-bottom: 10px;
    background-color: white !important;
    color: #212529 !important;
}

/* Extracted paths area */
#callidraw-extractedPaths {
    margin: 20px auto;
    max-width: 1200px;
    padding: 10px;
    border: 1px solid #ccc;
    margin-bottom: 10px;
    background-color: #fcfcfc;
    width: 80vw;
    display: none;
}

#callidraw-extractedPaths h3 {
    margin: 0;
    font-size: 18px;
    display: inline-block;
    float: left;
}

#callidraw-extractedPathsOutput {
    width: 98%;
    height: 150px;
    font-family: monospace;
    font-size: 14px;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
    resize: vertical;
    margin-top: 10px;
    margin-bottom: 10px;
    background-color: white !important;
    color: #212529 !important;
}

/* Background image */
#callidraw-bgLayer image {
    pointer-events: none;
}

/* Button styles */
.btn-red {
    background-color: #e53935;
}

.btn-red:hover {
    background-color: #c62828;
}

.btn-blue {
    background-color: #1e88e5;
}

.btn-blue:hover {
    background-color: #1565c0;
}

.reset-button {
    background-color: #dd4343;
}

.reset-button:hover {
    background-color: #a62727;
}

.bg-button {
    background-color: #c06437;
}

.bg-button:hover {
    background-color: #974319;
}

.help-button {
    background-color: #28a745;
    color: #fff;
}

.help-button:hover {
    background-color: #1b742f;
}

/* Toast Notification Styles */
.callidraw-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
}

.callidraw-toast {
    background: #333;
    color: white;
    padding: 12px 20px;
    margin-bottom: 10px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideInRight 0.3s ease-out;
    min-width: 300px;
    font-size: 14px;
    line-height: 1.4;
}

.callidraw-toast.success {
    background: #28a745;
    border-left: 4px solid #1e7e34;
}

.callidraw-toast.error {
    background: #dc3545;
    border-left: 4px solid #c82333;
}

.callidraw-toast.warning {
    background: #ffc107;
    color: #212529;
    border-left: 4px solid #e0a800;
}

.callidraw-toast.info {
    background: #17a2b8;
    border-left: 4px solid #138496;
}

.callidraw-toast.question {
    background: #6f42c1;
    border-left: 4px solid #5a32a3;
}

.callidraw-toast-content {
    flex: 1;
    display: flex;
    align-items: center;
}

.callidraw-toast-icon {
    margin-right: 10px;
    font-size: 16px;
}

.callidraw-toast-actions {
    margin-left: 15px;
    display: flex;
    gap: 8px;
}

.callidraw-toast-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.callidraw-toast-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.callidraw-toast-btn.primary {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.callidraw-toast-btn.primary:hover {
    background: white;
}

.callidraw-toast-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    margin-left: 10px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.callidraw-toast-close:hover {
    opacity: 1;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.callidraw-toast.removing {
    animation: slideOutRight 0.3s ease-in forwards;
}

/* Modal styles */
.callidraw-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.callidraw-modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    width: 300px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.callidraw-modal-content button {
    margin: 10px;
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.callidraw-modal-content button:hover {
    background-color: #2980b9;
}

.callidraw-modal-content-2 button {
    margin: 10px;
    padding: 10px 20px;
    background-color: #c73b3b;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.callidraw-modal-content-2 button:hover {
    background-color: #c73b3b;
}

/* Visual Guide styles */
.vg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    pointer-events: none;
}

.vg-guide-box {
    position: absolute;
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    max-width: 350px;
    width: 90%;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: translateY(-20px);
}

.vg-guide-box.active {
    opacity: 1;
    transform: translateY(0);
}

.vg-guide-arrow {
    position: absolute;
    width: 0;
    height: 0;
}

.vg-guide-arrow.down {
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid #fff;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
}

.vg-guide-arrow.up {
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 12px solid #fff;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
}

.vg-guide-header {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    color: #007bff;
    position: relative;
}

.vg-guide-header i {
    margin-right: 8px;
}

.vg-guide-close-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #777;
    transition: color 0.2s ease-in-out;
}

.vg-guide-close-btn:hover {
    color: #333;
}

.vg-guide-text {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
}

.vg-guide-controls {
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.vg-guide-controls .vg-progress {
    font-size: 14px;
    color: #777;
}

.vg-guide-controls button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background-color: #007bff;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.vg-guide-controls button:hover {
    background-color: #0056b3;
}

.vg-guide-controls button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.vg-highlight {
    position: relative;
    z-index: 999;
    box-shadow: 0 0 20px 5px rgba(0, 123, 255, 0.6);
    border-radius: 6px;
    transition: box-shadow 0.3s ease-in-out;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .callidraw-control-row {
        flex-direction: column;
        align-items: stretch;
    }

    .callidraw-right-controls {
        margin-left: 0;
        margin-top: 10px;
    }

    #callidraw-bg-controls {
        width: 100%;
        justify-content: center;
    }

    .callidraw-line-controls {
        margin-left: 0;
        justify-content: center;
    }

    #callidraw-information-content {
        gap: 20px;
        justify-content: center;
    }

    #callidraw-information-content p {
        margin: 0px 10px;
    }

    #callidraw-bg-controls {
        justify-content: center;
        padding: 10px;
    }

    #callidraw-bg-controls > * {
        margin: 5px;
    }
}

@media (max-width: 480px) {
    #callidraw-information-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    #callidraw-information-content p {
        margin: 5px 0;
    }

    #callidraw-bg-controls {
        flex-direction: column;
        align-items: flex-start;
        padding: 8px;
    }

    #callidraw-bg-controls > * {
        margin: 5px 0;
    }
}
