:root {
    --primary: #6366F1;
    --primary-light: #818CF8;
    --primary-dark: #77b429;
    --secondary: #10B981;
    --dark: #1F2937;
    --light: #F9FAFB;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
    --border-radius: 10px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    display: grid;
    grid-template-columns: 360px 1fr;
    min-height: 100vh;
}

.sidebar {
    margin-bottom: 3rem;
    background: white;
    border-right: 1px solid var(--gray-200);
    padding: 1.5rem;
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: 100vh;
}

.main-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.headerp {
    margin-bottom: 0.3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.headerp h1 {
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;

}

.headerp p {
    text-align: center;
    color: var(--gray-500);
    font-size: 1rem;
    max-width: 80%;
    margin: 0 auto;
}

.tool-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    flex-grow: 1;
}

.controls {
    background: white;
    border-radius: var(--border-radius);
    height: fit-content;
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

.control-group {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.control-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.control-group h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preview-container {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--gray-200);
    position: relative;
    min-height: 500px;
    box-shadow: var(--shadow-sm);
    background-color: var(--gray-50);
    flex-direction: column;
    gap: 1rem;
    cursor: move;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    text-align: center;
}

.preview-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--gray-300);
}

#previewCanvas {
    max-width: 100%;
    max-height: 600px;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    display: none;
}

.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--border-radius);
    padding: 2.5rem 1rem;
    text-align: center;
    margin-bottom: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    background: var(--gray-50);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.03);
}

.upload-area.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

#fileInput {
    display: none;
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9375rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--dark);
}

input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    background: var(--gray-200);
    border-radius: 3px;
    outline: none;
    margin: 0.75rem 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: var(--primary-dark);
}

select, input[type="text"] {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-family: 'Inter', sans-serif;
    font-size: 0.9375rem;
    transition: var(--transition);
    background: white;
    margin-bottom: 1rem;
}

select:focus, input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

input[type="color"] {
    width: 100%;
    height: 42px;
    padding: 2px;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-300);
    cursor: pointer;
    background: white;
}

.slider-value {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: -0.5rem;
}

.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.position-btn {
    background: white;
    border: 1px solid var(--gray-300);
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 36px;
    transition: var(--transition);
}

.position-btn:hover {
    border-color: var(--gray-400);
    background: var(--gray-50);
}

.position-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.rotate-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.rotate-value {
    flex: 1;
    text-align: center;
    font-size: 0.9375rem;
    color: var(--gray-700);
    font-weight: 500;
}

.watermark-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: none;
    box-shadow: var(--shadow-md);
    border: 2px solid white;
}

.drag-handle {
    right: -8px;
    bottom: -8px;
}

.toast {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--border-radius);
    background-color: var(--dark);
    color: white;
    box-shadow: var(--shadow-lg);
    transform: translateX(150%);
    transition: var(--transition);
    z-index: 1000;
    max-width: 90%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9375rem;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    background-color: var(--error);
}

.toast.success {
    background-color: var(--success);
}

/* Blog section */
.blog-section {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-top: 2rem;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.blog-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--dark);
}

.blog-section p {
    margin-bottom: 1rem;
    color: var(--gray-700);
    line-height: 1.6;
}

/* Icons */
.icon {
    width: 20px;
    height: 20px;
}

.icon-sm {
    width: 18px;
    height: 18px;
}

/* Layout adjustments */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
    }
    .header p {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    .preview-container {
        padding: 1rem;
        min-height: 300px;
    }
    .position-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .sidebar {
        padding: 1rem;
    }
    .header h1 {
        font-size: 1.5rem;
    }
    .position-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .btn {
        padding: 0.75rem;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--gray-100);
}
::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade {
    animation: fadeIn 0.3s ease-out forwards;
}
