body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f0f0;
    color: #333;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    font-size: 2em;
    margin: 0;
    color: #007BFF;
}

header p {
    margin: 5px 0;
    color: #666;
}

.main-container {
    display: flex;
    gap: 20px;
}


.sidebar {
    flex: 1;
    max-width: 400px;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.canvas-area {
    flex: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.search-area {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 600px;
}

#image-search-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
}

#image-search-btn {
    background-color: #007BFF;
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 1em;
}

#image-search-btn:hover {
    background-color: #0056b3;
}

#upload-area {
    border: 2px dashed #ccc;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    background-color: #fff;
    border-radius: 8px;
    width: 100%;
    max-width: 600px;
}

#upload-area:hover {
    background-color: #e0e0e0;
}

#upload-area p {
    margin: 0;
    font-size: 1.1em;
    color: #666;
}

#canvas-container {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 5;
}

#crop-rect {
    position: absolute;
    border: 2px dashed #fff;
    background: rgba(255, 255, 255, 0.2);
    pointer-events: auto;
}

.crop-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #fff;
    border: 1px solid #000;
    cursor: pointer;
    pointer-events: auto;
}

.crop-handle.top-left {
    top: -5px;
    left: -5px;
    cursor: nwse-resize;
}

.crop-handle.top-right {
    top: -5px;
    right: -5px;
    cursor: nesw-resize;
}

.crop-handle.bottom-left {
    bottom: -5px;
    left: -5px;
    cursor: nesw-resize;
}

.crop-handle.bottom-right {
    bottom: -5px;
    right: -5px;
    cursor: nwse-resize;
}

.canvas-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
    z-index: 10;
    position: relative;
}

#crop-image-btn {
    background-color: #007BFF;
    color: white;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 1em;
    transition: background-color 0.2s;
}

#crop-image-btn:hover {
    background-color: #0056b3;
}

#crop-image-btn:active {
    background-color: #003d82;
}

#crop-image-btn.cancel {
    background-color: #dc3545; /* Red for Cancel Crop */
}

#crop-image-btn.cancel:hover {
    background-color: #c82333;
}

#crop-image-btn.cancel:active {
    background-color: #a71d2a;
}

#crop-instructions {
    color: #333;
    font-size: 1em;
    margin: 0;
}

#confirm-crop-btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 1em;
    transition: background-color 0.2s;
}

#confirm-crop-btn:hover {
    background-color: #218838;
}

#confirm-crop-btn:active {
    background-color: #1c6d32;
}

.text-controls {
    display: flex;
    gap: 15px;
}

.control-column {
    flex: 1;
}

.control-group {
    margin-bottom: 20px;
}

.control-group h3 {
    margin: 0 0 10px 0;
    font-size: 1.2em;
    color: #007BFF;
}

.control-group input,
.control-group select {
    display: block;
    width: 100%;
    margin: 5px 0;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.control-group input[type="color"] {
    height: 40px;
    padding: 0;
}

.control-group label {
    display: block;
    margin: 5px 0;
    font-size: 0.9em;
}

button {
    background-color: #007BFF;
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
    width: 100%;
    margin: 5px 0;
    border-radius: 5px;
    font-size: 1em;
}

button:hover {
    background-color: #0056b3;
}

.action-buttons {
    margin-top: 20px;
}

.invisible-link {
    width: 100%;
    height: 20px;
    opacity: 0;
    cursor: pointer;
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    .sidebar {
        max-width: 100%;
    }
    .text-controls {
        flex-direction: column;
    }
    .canvas-area {
        width: 100%;
    }
    .search-area {
        flex-direction: column;
        max-width: 100%;
    }
    #image-search-btn {
        width: 100%;
    }
    #canvas {
        max-width: 100%;
    }
    .canvas-controls {
        flex-direction: column;
        align-items: stretch;
    }
}
