:root {
    /* Color Palette */
    --bg-main: #09090b;
    --bg-card: #18181b;
    --bg-card-hover: #27272a;
    --border: #3f3f46;
    --border-light: #52525b;
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --accent: #f97316;
    --accent-hover: #ea580c;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    
    /* Layout */
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.section-desc { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 1.5rem; }

/* Layout */
.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.app-header {
    text-align: center;
    margin-bottom: 3rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--accent);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.logo i { font-size: 2.5rem; }
.logo h1 { color: var(--text-primary); font-weight: 700; }

/* Stages */
.stage {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.stage.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Glass Card styling */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
}

/* Forms */
textarea {
    width: 100%;
    height: 350px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    color: var(--text-primary);
    font-family: 'Inter', monospace;
    font-size: 0.9rem;
    resize: vertical;
    transition: var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.action-bar {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

.action-bar.between {
    justify-content: space-between;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--accent);
    color: #fff;
    box-shadow: 0 4px 14px 0 rgba(249, 115, 22, 0.39);
}

.btn-primary:not(:disabled):hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.23);
}

.btn-secondary {
    background-color: var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--border-light);
}

/* Preview Stage */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
}

.title-group {
    margin-bottom: 3rem;
}

.group-title {
    font-size: 1.25rem;
    color: var(--accent);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.group-title i { opacity: 0.7; }

/* Grid for Products */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

/* Product Card */
.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: var(--transition);
    overflow: hidden;
}

.product-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.5);
}

.product-card.deleting {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

/* Amazon Image Area */
.product-img-wrapper {
    height: 160px;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-preview-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #fff; /* Amazon images are usually on white background, looks cleaner */
    padding: 0.5rem;
}

.product-img-mock {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--border-light);
}

.product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 0.95rem;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.product-link {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: auto;
}

.product-link i { font-size: 1rem; }
.product-link:hover { color: var(--accent); }

/* Delete Button on Card */
.btn-delete {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0;
}

.product-card:hover .btn-delete {
    opacity: 1;
}

.btn-delete:hover {
    background: var(--danger);
    color: #fff;
    transform: scale(1.1);
}

/* Empty Group Message */
.empty-group-msg {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.9rem;
    padding: 1rem;
    background: rgba(255,255,255,0.02);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: #000;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.4);
    transition: 0.3s ease;
    z-index: 1000;
}

.toast.hidden {
    opacity: 0;
    transform: translate(-50%, 20px);
    pointer-events: none;
}
