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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #81C784 0%, #4CAF50 100%);
    min-height: 100vh;
    padding: 15px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    height: calc(100vh - 30px);
    display: flex;
    flex-direction: column;
}

.header {
    background: linear-gradient(135deg, #81C784 0%, #4CAF50 100%);
    color: white;
    padding: 15px 20px;
    text-align: center;
}

.header .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.header .logo i {
    font-size: 24px;
}

.header h1 {
    font-size: 22px;
    font-weight: 600;
}

.header .subtitle {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 4px;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.left-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 15px;
    background: #f8f9fa;
    overflow-y: auto;
}

.preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.upload-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px dashed #c8e6c9;
    border-radius: 8px;
    background: #f5f9f5;
    min-height: 300px;
}

.upload-placeholder:hover {
    border-color: #4CAF50;
    background: #E8F5E9;
}

.upload-placeholder.dragover {
    border-color: #388E3C;
    background: #C8E6C9;
}

.upload-placeholder .upload-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #81C784 0%, #4CAF50 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 36px;
    margin-bottom: 15px;
}

.upload-placeholder .upload-title {
    font-size: 18px;
    color: #333;
    margin-bottom: 8px;
    font-weight: 500;
}

.upload-placeholder .hint {
    font-size: 13px;
    color: #999;
}

.preview-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.preview-container canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stamp-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stamp-element {
    position: absolute;
    cursor: move;
    pointer-events: auto;
    user-select: none;
    transition: transform 0.1s;
}

.stamp-element:hover {
    transform: scale(1.05);
}

.stamp-element canvas {
    background: transparent;
    display: block;
}

.stamp-element.selected {
    outline: 2px dashed #4CAF50;
    border-radius: 4px;
}

.stamp-delete-btn {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: #d32f2f;
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background 0.2s;
}

.stamp-delete-btn:hover {
    background: #c62828;
}

.image-rotate-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.overlay-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.overlay-btn:hover {
    background: #4CAF50;
}

.overlay-btn:hover i {
    color: white;
}

.overlay-btn i {
    color: #4CAF50;
    font-size: 14px;
}

.actions-section {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-top: 15px;
    gap: 8px;
}

.actions-section .btn {
    flex: 1;
    padding: 10px 16px;
    min-width: auto;
}

.format-select {
    padding: 10px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: white;
    color: #333;
    transition: all 0.3s ease;
    outline: none;
    min-width: 110px;
}

.format-select:hover {
    border-color: #4CAF50;
    background: #f5fdf5;
}

.format-select:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-small {
    flex: none;
    padding: 6px 12px;
    font-size: 12px;
}

.btn-primary {
    background: linear-gradient(135deg, #81C784 0%, #4CAF50 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #666;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-upload {
    background: linear-gradient(135deg, #64B5F6 0%, #2196F3 100%);
    color: white;
}

.btn-upload:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
}

.right-panel {
    width: 280px;
    background: #ffffff;
    border-left: 1px solid #e0e0e0;
    padding: 15px;
    overflow-y: auto;
}

.accordion-group {
    margin-bottom: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    transition: background 0.3s;
}

.accordion-header:hover {
    background: #e8f5e9;
}

.accordion-header i:first-child {
    color: #4CAF50;
    margin-right: 8px;
}

.accordion-icon {
    color: #999;
    font-size: 12px;
    transition: transform 0.3s;
}

.accordion-header.open .accordion-icon {
    transform: rotate(90deg);
}

.accordion-content {
    padding: 10px 12px;
    background: white;
    transition: max-height 0.3s ease-out;
}

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

.control-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
}

.control-group label i {
    color: #4CAF50;
    font-size: 14px;
}

.control-group input[type="text"],
.control-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    transition: border-color 0.3s;
}

.control-group input[type="text"]:focus,
.control-group select:focus {
    outline: none;
    border-color: #4CAF50;
}

.color-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group input[type="color"] {
    width: 40px;
    height: 30px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
}

.color-value {
    font-size: 12px;
    color: #666;
}

.range-row {
    display: flex;
    align-items: center;
}

.control-group input[type="range"] {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
}

.control-group input[type="number"].input-value {
    width: 60px;
    padding: 5px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 12px;
    text-align: right;
    margin-left: 8px;
    color: #666;
}

.control-group input[type="number"].input-value:focus {
    outline: none;
    border-color: #4CAF50;
}

.checkbox-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.checkbox-group label {
    margin-bottom: 0;
}

.control-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4CAF50;
}

.control-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 14px 0;
}

.hint-text {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

.footer {
    background: #f5f5f5;
    padding: 10px;
    text-align: center;
    font-size: 11px;
    color: #999;
}

@media (max-width: 768px) {
    .container {
        height: auto;
        min-height: 100vh;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .left-panel {
        min-height: 300px;
    }
    
    .right-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid #e0e0e0;
    }
}