/* Responsive Drawing Plugin Styles - All Features */

.my-drawing-app-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 10px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.my-drawing-topbar {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
}

.toolbar-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    min-height: 36px;
}

.control-group label {
    font-weight: 600;
    font-size: 13px;
    color: #495057;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 60px;
}

/* All Buttons */
.tool-button,
.shape-button,
.action-button,
.zoom-button,
.tool-mode-button {
    padding: 8px 16px;
    border: 1px solid #ced4da;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 36px;
    color: #495057;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.tool-button:hover,
.shape-button:hover,
.action-button:hover,
.zoom-button:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tool-button:active,
.shape-button:active,
.action-button:active,
.zoom-button:active {
    transform: translateY(0);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.tool-button.active {
    background: #007bff;
    color: white;
    border-color: #0056b3;
}

.primary-button {
    background: #28a745;
    color: white;
    border-color: #1e7e34;
    font-weight: 600;
}

.primary-button:hover {
    background: #218838;
    border-color: #1e7e34;
}

.delete-button {
    background: #dc3545;
    color: white;
    border-color: #bd2130;
}

.delete-button:hover {
    background: #c82333;
    border-color: #bd2130;
}

/* Shape buttons with visible symbols */
.shape-button {
    font-size: 20px;
    padding: 6px 12px;
    min-width: 36px;
    width: 36px;
    height: 36px;
}

/* Zoom buttons */
.zoom-button {
    padding: 6px 12px;
    min-width: 36px;
}

/* Color Palette */
.color-palette {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.color-swatch:hover {
    transform: scale(1.1);
    border-color: #6c757d;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.color-swatch.active {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
}

/* Inputs and Selects */
input[type="color"] {
    width: 50px;
    height: 36px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    padding: 2px;
}

select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    height: 36px;
    min-width: 100px;
    color: #495057;
}

select:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

input[type="range"] {
    width: 100px;
    height: 36px;
    vertical-align: middle;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-right: 5px;
}

#opacity-value,
#zoom-level {
    font-size: 13px;
    color: #6c757d;
    min-width: 45px;
    font-weight: 600;
}

/* Text Input */
#my-drawing-text-input {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    width: 200px;
    height: 36px;
}

/* Canvas Area */
.my-drawing-canvas-area {
    position: relative;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    margin: 0 auto;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#my-drawing-main-canvas {
    display: block;
    cursor: crosshair;
    background: white;
}

#my-drawing-grid-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    opacity: 0.3;
}

.my-drawing-message {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    display: none;
}

.my-drawing-message.show {
    display: block;
}

/* Layer Panel */
#my-drawing-layer-panel {
    position: absolute;
    right: 10px;
    top: 60px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
    width: 200px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Button text visibility fixes */
.action-button,
.tool-button {
    font-size: 13px;
    letter-spacing: 0.3px;
}

/* Mode toggle button */
.tool-mode-button {
    background: #17a2b8;
    color: white;
    border-color: #138496;
    font-weight: 600;
    padding: 10px 20px;
    font-size: 14px;
}

.tool-mode-button:hover {
    background: #138496;
    border-color: #117a8b;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .toolbar-row {
        gap: 15px;
    }
    
    .control-group {
        gap: 8px;
    }
    
    .control-group label {
        min-width: auto;
        font-size: 12px;
    }
}

@media (max-width: 992px) {
    .toolbar-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .control-group {
        justify-content: flex-start;
        padding: 8px;
        background: white;
        border-radius: 4px;
        border: 1px solid #e9ecef;
    }
}

@media (max-width: 768px) {
    .my-drawing-topbar {
        padding: 10px;
    }
    
    .toolbar-row {
        gap: 8px;
    }
    
    .control-group {
        flex-wrap: wrap;
    }
    
    .tool-button,
    .shape-button,
    .action-button,
    .zoom-button {
        padding: 6px 10px;
        font-size: 12px;
        min-width: auto;
    }
    
    .color-swatch {
        width: 24px;
        height: 24px;
    }
    
    select {
        font-size: 12px;
        padding: 6px 10px;
        min-width: 80px;
    }
    
    input[type="range"] {
        width: 80px;
    }
}

@media (max-width: 480px) {
    .my-drawing-app-container {
        padding: 5px;
    }
    
    .control-group label {
        width: 100%;
        margin-bottom: 5px;
        font-size: 11px;
    }
    
    .tool-button,
    .shape-button,
    .action-button,
    .zoom-button,
    .tool-mode-button {
        padding: 8px;
        font-size: 11px;
        flex: 1;
        min-width: auto;
    }
    
    .color-palette {
        width: 100%;
        justify-content: flex-start;
    }
    
    .color-swatch {
        width: 20px;
        height: 20px;
    }
    
    input[type="range"] {
        width: 100%;
    }
    
    select {
        width: 100%;
    }
    
    #my-drawing-text-input {
        width: 100%;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .tool-button,
    .shape-button,
    .action-button,
    .zoom-button,
    .tool-mode-button {
        padding: 10px 14px;
        font-size: 14px;
        min-height: 44px;
    }
    
    .color-swatch {
        width: 32px;
        height: 32px;
    }
    
    input[type="color"] {
        width: 50px;
        height: 44px;
    }
    
    select {
        height: 44px;
        font-size: 16px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .my-drawing-topbar {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .toolbar-row {
        border-bottom-color: #4a5568;
    }
    
    .control-group label {
        color: #cbd5e0;
    }
    
    .tool-button,
    .shape-button,
    .action-button,
    .zoom-button {
        background: #374151;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .tool-button:hover,
    .shape-button:hover,
    .action-button:hover,
    .zoom-button:hover {
        background: #4a5568;
        border-color: #718096;
    }
    
    select {
        background: #374151;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .my-drawing-canvas-area {
        border-color: #4a5568;
    }
    
    .control-group {
        background: #374151;
        border-color: #4a5568;
    }
}

/* Accessibility */
.tool-button:focus,
.shape-button:focus,
.action-button:focus,
.zoom-button:focus,
.tool-mode-button:focus,
select:focus,
input:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Loading State */
.loading {
    opacity: 0.5;
    pointer-events: none;
}

.loading::after {
    content: "Loading...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: 600;
}

/* Fix button visibility */
button:empty::after {
    content: attr(title);
}

/* Ensure all buttons have proper styling */
button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Fix for Upload button */
button[onclick*="image-upload"]::after {
    content: "📁 Upload Image";
}