/* Signature Enhancer Premium CSS */

:root {
    --sig-primary: #4f46e5;
    --sig-primary-dark: #4338ca;
    --sig-bg: #f8fafc;
    --sig-card-bg: #ffffff;
    --sig-text: #0f172a;
    --sig-text-muted: #64748b;
    --sig-border: #e2e8f0;
}

/* --- Hero Section --- */
.sig-hero {
    background: radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
                radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%), 
                radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
    background-color: #0f172a;
    padding: 6rem 2rem 4rem; /* Increased padding */
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem; /* Spacing instead of overlap */
}

/* Modern Grid Background */
.sig-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    z-index: 0;
    mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
}

.sig-content {
    position: relative;
    z-index: 10;
}

.sig-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #a5b4fc;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.sig-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    line-height: 1.1;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sig-subtitle {
    font-size: 1.1rem;
    color: #94a3b8;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

/* --- Tool Workspace --- */
.tool-section {
    position: relative;
    margin-top: 0; /* REMOVED OVERLAP */
    margin-bottom: 4rem;
    padding: 0 1rem;
    z-index: 20;
}

.workspace-card {
    background: var(--sig-card-bg);
    border-radius: 20px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--sig-border);
    overflow: hidden;
    min-height: 400px; /* Reduced from 600px */
    display: flex;
    flex-direction: column;
    max-width: 1000px;
    margin: 0 auto;
}

/* 1. Upload View */
.upload-view {
    padding: 3rem 1.5rem; /* Reduced padding */
    text-align: center;
    border: 2px dashed var(--sig-border);
    margin: 1.5rem; /* Reduced margin */
    border-radius: 16px;
    background: #f8fafc;
    transition: all 0.3s ease;
    cursor: pointer;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.upload-view:hover {
    border-color: var(--sig-primary);
    background: #eff6ff;
}

.upload-icon {
    font-size: 4rem;
    color: #cbd5e1;
    margin-bottom: 1.5rem;
    transition: color 0.3s ease;
}

.upload-view:hover .upload-icon {
    color: var(--sig-primary);
}

.btn-upload {
    background: var(--sig-primary);
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    border: none;
    margin-top: 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s;
}

.btn-upload:hover {
    transform: translateY(-2px);
    background: var(--sig-primary-dark);
}

/* 2. Editor Layout */
.editor-layout {
    display: flex;
    flex-direction: column;
    min-height: 500px; /* Flexible height */
}

@media (min-width: 900px) {
    .editor-layout {
        flex-direction: row;
        height: 600px; /* Fixed but smaller height for desktop */
    }
}

/* Preview Area (Left/Top) */
.preview-area {
    flex: 1;
    background: url('../img/transparent-bg.png'); /* Checkerboard pattern */
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid var(--sig-border);
    min-height: 300px; /* Ensure visibility on mobile */
}

@media (min-width: 900px) {
    .preview-area {
        border-bottom: none;
        border-right: 1px solid var(--sig-border);
    }
}

#previewCanvas {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    border-radius: 4px; /* Slight round for aesthetics */
}

.zoom-controls {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 0.5rem;
    border-radius: 50px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    display: flex;
    gap: 0.5rem;
    border: 1px solid var(--sig-border);
}

.btn-zoom {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 1px solid var(--sig-border);
    background: white;
    cursor: pointer;
    color: var(--sig-text);
    display: flex; align-items: center; justify-content: center;
}

.btn-zoom:hover { background: #f1f5f9; }

/* Controls Sidebar (Right/Bottom) */
.controls-sidebar {
    width: 100%;
    padding: 1.5rem;
    background: white;
    overflow-y: auto;
    /* On mobile, limit height so it scrolls instead of making page huge */
    max-height: 50vh; 
}

@media (min-width: 900px) {
    .controls-sidebar {
        width: 350px;
        border-left: 1px solid var(--sig-border);
        max-height: none; /* Full height on desktop */
    }
}

.control-group {
    margin-bottom: 2rem;
    background: #f8fafc;
    padding: 1.25rem;
    border-radius: 16px;
    border: 1px solid var(--sig-border);
}

.group-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--sig-text);
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
}

/* Range Sliders */
input[type=range] {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 5px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--sig-primary);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Toggles */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px; height: 24px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute; cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute; content: "";
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider { background-color: var(--sig-primary); }
input:checked + .slider:before { transform: translateX(20px); }

/* Download Section */
.download-section {
    text-align: center;
    margin-top: 1rem;
}

.file-info {
    font-size: 0.8rem;
    color: var(--sig-text-muted);
    margin-bottom: 1rem;
    background: #fff;
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--sig-border);
    display: inline-block;
}

/* Feature Grid (Below tool) */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 4rem;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--sig-border);
    text-align: center;
    transition: transform 0.3s;
}

.feature-card:hover { transform: translateY(-5px); }
