/* Variables & Reset */
:root {
    --bg-color: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #6366f1;
    /* Indigo */
    --accent-hover: #4f46e5;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.03);
    --danger: #ef4444;
    --success: #22c55e;

    --font-main: 'Outfit', sans-serif;

    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;

    --glass-light-bg: rgba(255, 255, 255, 0.03);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

:root.light-mode {
    --bg-color: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-highlight: rgba(0, 0, 0, 0.03);
    --glass-light-bg: rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Effects */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 10s infinite ease-in-out;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #4f46e5;
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: #db2777;
    /* Pink */
    bottom: -50px;
    right: -50px;
    animation-delay: -2s;
}

.blob-3 {
    width: 250px;
    height: 250px;
    background: #0ea5e9;
    /* Sky */
    top: 40%;
    left: 40%;
    animation-delay: -5s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(30px, -30px);
    }
}

/* Layout */
.app-container {
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.glass-panel-light {
    background: var(--glass-light-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}

/* Header */
.app-header {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo i {
    color: var(--accent-color);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.icon-btn:hover {
    color: var(--text-primary);
    background: var(--glass-highlight);
}

/* Main Content */
.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Upload Section */
.upload-section {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    transition: var(--transition);
}

.drop-zone {
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.01);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent-color);
    background: rgba(99, 102, 241, 0.05);
}

.icon-wrapper {
    font-size: 4rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.drop-zone:hover .icon-wrapper {
    color: var(--accent-color);
    transform: scale(1.1);
}

.drop-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.highlight {
    color: var(--accent-color);
    font-weight: 600;
    text-decoration: underline;
}

.sub-text {
    color: var(--text-secondary);
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Workspace (Preview + Settings) */
.workspace-section {
    display: flex;
    gap: 2rem;
    height: 100%;
    animation: fadeIn 0.5s ease-out;
}

.workspace-section.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preview-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
    /* For scrolling */
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.text-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 500;
}

.text-danger {
    color: var(--danger);
}

.text-danger:hover {
    text-decoration: underline;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.image-card {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--glass-border);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.image-card:hover img {
    transform: scale(1.05);
}

.remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.image-card:hover .remove-btn {
    opacity: 1;
}

.remove-btn:hover {
    background: var(--danger);
}

.rotate-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.image-card:hover .rotate-btn {
    opacity: 1;
}

.rotate-btn:hover {
    background: var(--accent-color);
}

.image-card.dragging {
    opacity: 0.5;
    border: 2px dashed var(--accent-color);
}

.image-card.drag-over-card {
    transform: scale(1.05);
    box-shadow: 0 0 10px var(--accent-color);
}

/* Settings Panel */
.settings-panel {
    width: 300px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.setting-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.toggle-group {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.toggle-group input[type="radio"] {
    display: none;
}

.toggle-btn {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    color: var(--text-secondary);
}

.toggle-group input:checked+.toggle-btn {
    background: var(--glass-highlight);
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.select-wrapper {
    position: relative;
}

select {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    appearance: none;
    cursor: pointer;
    font-family: var(--font-main);
}

select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.text-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    transition: var(--transition);
}

.text-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

body.light-mode .text-input,
body.light-mode select {
    background: rgba(255, 255, 255, 0.5);
}

.select-wrapper i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-secondary);
}

.btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Footer */
footer {
    padding: 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--glass-border);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    padding: 1rem 2rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    z-index: 100;
    animation: slideUp 0.3s ease-out;
}

.toast.hidden {
    display: none;
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.toast i {
    color: var(--success);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Text Content Pages */
.text-content {
    max-width: 800px;
    margin: 0 auto;
    color: var(--text-primary);
    /* Brighter text for better readability */
    line-height: 1.6;
}

.text-content h1 {
    color: var(--text-primary);
    margin-bottom: 2rem;
    font-size: 2.5rem;
}

.text-content h2 {
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.text-content p {
    margin-bottom: 1rem;
}

.text-content a {
    color: #3b82f6;
    /* Bright Blue */
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
}

/* Light mode specific link color if needed, but blue works on both usually. 
   Let's make it slightly darker for light mode via body class if needed, 
   but standard blue #3b82f6 is good on white too. */
body.light-mode .text-content a {
    color: #2563eb;
    /* Darker blue for light mode */
}

.text-content a:hover {
    color: #93c5fd;
    text-decoration: underline;
}

.sitemap-list {
    list-style: none;
}

.sitemap-list li {
    margin-bottom: 1rem;
}

.sitemap-list a {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sitemap-list a::before {
    content: '\f15c';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: var(--text-secondary);
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
    margin: 0 0.5rem;
    transition: var(--transition);
}

footer a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}