:root {
    --bg: #0f172a;      /* Dark Blue Slate */
    --card: #1e293b;    /* Lighter Slate */
    --border: #334155;  /* Border */
    --fg: #f8fafc;      /* White */
    --muted: #94a3b8;   /* Gray */
    --accent: #38bdf8;  /* Sky Blue */
    --error: #f43f5e;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Space Grotesk', sans-serif;
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.bg-pattern {
    position: fixed; inset: 0;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(56, 189, 248, 0.05) 0%, transparent 40%);
    background-size: 100% 100%;
    pointer-events: none; z-index: 0;
}

nav {
    position: relative; z-index: 10;
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.5rem 5%;
    border-bottom: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
}

.logo { display: flex; align-items: center; gap: 0.75rem; font-size: 1.25rem; font-weight: 700; }
.logo-icon {
    width: 40px; height: 40px; background: var(--accent);
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    color: var(--bg); box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

main {
    position: relative; z-index: 10;
    max-width: 1100px; margin: 0 auto; padding: 3rem 1.5rem;
}

header { text-align: center; margin-bottom: 3rem; }
header h1 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: 0.5rem; line-height: 1.2; }
.accent { color: var(--accent); }
header p { color: var(--muted); font-size: 1.1rem; }

.container-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .container-grid { grid-template-columns: 1fr; }
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 2rem;
}

.card h2 {
    display: flex; align-items: center; gap: 0.75rem;
    margin-bottom: 1.5rem; font-size: 1.25rem;
}

.icon-box {
    width: 36px; height: 36px; border-radius: 10px;
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent); display: flex; align-items: center; justify-content: center;
}

.input-group { margin-bottom: 1.25rem; }
.input-group label { display: block; font-size: 0.875rem; margin-bottom: 0.5rem; font-weight: 500; }
.req { color: var(--error); }

input[type="text"], input[type="url"], textarea {
    width: 100%; padding: 0.875rem 1rem;
    background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
    color: var(--fg); font-family: inherit; transition: all 0.2s;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1); }

textarea { resize: none; height: 80px; }

/* File Upload Styles */
.file-upload-box {
    display: block; padding: 1.5rem;
    border: 2px dashed var(--border); border-radius: 10px;
    text-align: center; cursor: pointer; transition: all 0.2s;
    position: relative; min-height: 150px;
}
.file-upload-box:hover { border-color: var(--accent); background: rgba(56, 189, 248, 0.05); }
.upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; color: var(--muted); }

.image-preview-container {
    position: relative; width: 100%; height: 100%;
}
.image-preview-container img {
    max-width: 100%; max-height: 200px; border-radius: 8px; object-fit: contain;
}
.remove-img-btn {
    position: absolute; top: -10px; right: -10px;
    width: 24px; height: 24px; background: var(--error); color: white;
    border: 2px solid var(--card); border-radius: 50%;
    cursor: pointer; font-weight: bold; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.remove-img-btn:hover { transform: scale(1.1); }

/* Play Icon Option */
.play-icon-option {
    margin-top: 0.75rem; display: flex; align-items: center; gap: 0.5rem;
}
.play-icon-option input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--accent); }
.play-icon-option label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 0.9rem; color: var(--fg); }
.play-icon-option svg { color: var(--muted); }

.btn-primary {
    width: 100%; padding: 1rem;
    background: var(--accent);
    color: var(--bg); font-weight: 700; font-size: 1rem;
    border: none; border-radius: 10px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(56, 189, 248, 0.3); }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

/* Preview Section */
.social-preview {
    border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
    background: var(--bg);
}
.preview-img-container {
    height: 200px; background: var(--card); position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.preview-img-container img { width: 100%; height: 100%; object-fit: cover; display: none; }
.img-placeholder { color: var(--border); }
.preview-content { padding: 1rem; }
.preview-domain { font-size: 0.75rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 0.25rem; }
.preview-content h3 { font-size: 1.1rem; margin-bottom: 0.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-content p { font-size: 0.9rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.result-box { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.result-box label { font-size: 0.875rem; color: var(--muted); display: block; margin-bottom: 0.5rem; }
.copy-group { display: flex; gap: 0.5rem; }
.copy-group input { flex: 1; background: var(--card); }
.btn-copy {
    padding: 0 1.25rem; background: rgba(56, 189, 248, 0.1); color: var(--accent);
    border: 1px solid transparent; border-radius: 10px; cursor: pointer;
    display: flex; align-items: center; gap: 0.5rem; font-weight: 600;
    transition: all 0.2s;
}
.btn-copy:hover { background: rgba(56, 189, 248, 0.2); }

/* History Section */
.history-grid { display: grid; gap: 1rem; }
.history-item {
    background: var(--bg); border: 1px solid var(--border);
    padding: 1rem; border-radius: 10px;
    display: flex; flex-direction: column; gap: 0.5rem;
    transition: all 0.2s;
}
.history-item:hover { border-color: var(--accent); }
.history-url { font-family: monospace; color: var(--accent); font-size: 0.9rem; word-break: break-all; }
.history-meta { font-size: 0.85rem; color: var(--muted); }
.history-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.btn-action { flex: 1; padding: 0.5rem; border: none; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.85rem; transition: opacity 0.2s; }
.btn-copy-small { background: rgba(56, 189, 248, 0.1); color: var(--accent); }
.btn-copy-small:hover { background: rgba(56, 189, 248, 0.2); }
.btn-delete { background: rgba(244, 63, 94, 0.1); color: var(--error); }
.btn-delete:hover { background: rgba(244, 63, 94, 0.2); }

.empty-state { text-align: center; color: var(--muted); padding: 2rem 0; }

.hidden { display: none !important; }

.toast {
    position: fixed; bottom: 20px; right: 20px;
    background: var(--card); border: 1px solid var(--accent);
    padding: 1rem 1.5rem; border-radius: 10px; display: flex; align-items: center; gap: 0.75rem;
    transform: translateX(150%); transition: transform 0.4s ease; z-index: 999;
    color: var(--accent); font-weight: 500;
}
.toast.show { transform: translateX(0); }