* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.main-area {
    flex: 1;
    background-color: #333;
    position: relative;
    overflow: hidden;
}

.sidebar {
    width: 250px;
    background-color: #222;
    color: white;
    padding: 15px;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.5);
    max-height: 100vh;
    overflow-y: auto;
}

/* Scrollbar styling for the sidebar */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: #333;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #666;
}

.layer {
    position: absolute;
    border: 2px dashed #666;
    background-color: rgba(0, 0, 0, 0.2);
    cursor: move;
    overflow: hidden;
}

.layer.selected {
    border: 2px solid #00ff00;
}

.layer-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: white;
    border: 1px solid #333;
}

.handle-nw { top: -5px; left: -5px; cursor: nw-resize; }
.handle-ne { top: -5px; right: -5px; cursor: ne-resize; }
.handle-sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.handle-se { bottom: -5px; right: -5px; cursor: se-resize; }

.layer-content {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.layer-title {
    position: absolute;
    top: -25px;
    left: 0;
    color: white;
    font-size: 12px;
    background-color: rgba(0,0,0,0.5);
    padding: 2px 5px;
    border-radius: 3px;
}

.sidebar h2 {
    margin-bottom: 15px;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
}

.sidebar-section {
    margin-bottom: 20px;
}

.btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 8px 12px;
    margin: 5px 0;
    cursor: pointer;
    border-radius: 4px;
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
}

.btn:hover {
    background-color: #45a049;
}

.btn svg {
    margin-right: 8px;
}

.layer-list {
    list-style: none;
    margin-top: 10px;
}

.layer-item {
    padding: 8px;
    margin-bottom: 5px;
    background-color: #444;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.layer-item.active {
    background-color: #555;
    border-left: 3px solid #00ff00;
}

.canvas-output {
    display: none;
}

.settings-group {
    margin-bottom: 10px;
}

.settings-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #ccc;
}

.settings-group input[type="range"] {
    width: 100%;
}

.color-threshold {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.color-threshold input {
    margin-left: 10px;
    width: 60px;
}

.color-preview {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    background-color: #00ff00;
    margin-right: 10px;
}

.color-picker-tools {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.eyedropper-btn {
    background-color: #555;
    color: white;
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    margin-left: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eyedropper-btn:hover {
    background-color: #666;
}

.eyedropper-active {
    background-color: #4CAF50 !important;
}

/* Custom CSS for color input */
input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.license-info {
    margin-top: auto;
    font-size: 11px;
    color: #999;
    padding-top: 15px;
    border-top: 1px solid #444;
    line-height: 1.4;
}

.license-info a {
    color: #4CAF50;
    text-decoration: none;
}

.license-info a:hover {
    text-decoration: underline;
}

/* Eyedropper cursor styles */
.eyedropper-mode {
    cursor: crosshair !important;
}

/* Screenshot mode styles */
.screenshot-mode .layer {
    border: none !important;
}

.screenshot-mode .layer-handle, 
.screenshot-mode .layer-title {
    display: none !important;
}

/* Touch-Device Support */
.touch-device .layer.selected {
    border: 3px solid #00ff00;
}

.touch-resize-handle {
    position: absolute;
    width: 30px;
    height: 30px;
    background-color: rgba(255, 255, 255, 0.5);
    border: 2px solid #00ff00;
    bottom: -15px;
    right: -15px;
    border-radius: 50%;
    z-index: 100;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

/* Camera Modal Styles */
.camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.camera-content {
    background-color: #222;
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    padding: 20px;
    color: white;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
}

.camera-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #444;
}

.camera-header h2 {
    margin: 0;
    color: #4CAF50;
    font-size: 24px;
}

.close-camera-btn {
    background-color: #555;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-camera-btn:hover {
    background-color: #d32f2f;
    transform: scale(1.1);
}

.camera-preview-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

#cameraVideo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

#cameraCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.camera-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.btn-camera {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
    width: auto;
}

.btn-camera:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}

.btn-camera:active {
    transform: translateY(0);
}

.btn-camera svg {
    margin: 0;
}

.camera-info {
    text-align: center;
    color: #999;
    font-size: 13px;
    margin-top: 5px;
}

.camera-info small {
    display: block;
    line-height: 1.4;
}

/* Welcome Popup Styles */
.welcome-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.welcome-content {
    background-color: #222;
    border-radius: 8px;
    max-width: 700px;
    width: 90%;
    padding: 25px;
    color: white;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    max-height: 90vh;
    overflow-y: auto;
}

.welcome-content h2 {
    margin-top: 0;
    color: #4CAF50;
    text-align: center;
    border-bottom: 1px solid #444;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.workflow-container {
    display: flex;
    gap: 25px;
    margin: 20px 0;
}

.workflow-left {
    flex: 1;
}

.workflow-right {
    flex: 1;
}

.workflow-left h3,
.workflow-right h3 {
    color: #4CAF50;
    margin-bottom: 15px;
    font-size: 16px;
}

.workflow-visual {
    background-color: #333;
    border-radius: 8px;
    padding: 15px;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.6;
    border-left: 4px solid #4CAF50;
}

.tips-list {
    background-color: #333;
    border-radius: 8px;
    padding: 15px;
    border-left: 4px solid #4CAF50;
}

.tips-list p {
    margin-bottom: 12px;
    line-height: 1.5;
    font-size: 14px;
}

.tips-list p:last-child {
    margin-bottom: 0;
}

.button-container {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #444;
}

.workflow-step {
    margin: 15px 0;
    padding: 10px;
    background-color: #444;
    border-radius: 4px;
}

.workflow-step strong {
    color: #4CAF50;
    display: block;
    margin-bottom: 5px;
}

.welcome-info {
    margin-bottom: 20px;
}

.welcome-info h3 {
    color: #ddd;
    margin: 15px 0 10px 0;
}

.welcome-info ul {
    margin-left: 20px;
    padding-left: 0;
}

.welcome-info li {
    margin-bottom: 8px;
}

.welcome-info p {
    margin-bottom: 8px;
    line-height: 1.5;
}

.welcome-info p strong {
    color: #4CAF50;
}

#closeWelcomePopup {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

#closeWelcomePopup:hover {
    background-color: #45a049;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
    }
    
    .workflow-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .workflow-visual,
    .tips-list {
        font-size: 13px;
    }
    
    .touch-resize-handle {
        width: 40px;
        height: 40px;
        bottom: -20px;
        right: -20px;
    }
    
    .camera-content {
        width: 95vw;
        padding: 15px;
    }
    
    .camera-header h2 {
        font-size: 20px;
    }
    
    .btn-camera {
        padding: 12px 24px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .camera-preview-container {
        aspect-ratio: 3/4;
    }
    
    .btn-camera {
        width: 100%;
    }
}
