/* 
 * Icon Sprite Generator Styles
 * Theme: Dark Mode with Royal Purple (#6C5CE7) / Accent Pink (#FD79A8)
 */

:root {
    --bg-dark: #0D0B1E;
    /* Deep Dark Blue/Purple */
    --bg-surface: #1B183A;
    /* Slightly lighter surface */
    --bg-elevated: #2A2555;
    /* Elevated surface */
    --bg-darker: #060510;

    --primary: #6C5CE7;
    /* Royal Purple */
    --primary-hover: #5A4BDE;
    --secondary: #A29BFE;
    /* Light Purple */
    --accent: #FD79A8;
    /* Pink Accent */

    --text-main: #F8FAFC;
    --text-muted: #8E8BAE;
    --border: #3A356A;
    --danger: #FF4757;

    --font-main: 'Inter', system-ui, sans-serif;
    --font-code: 'Fira Code', monospace;

    --radius-xl: 16px;
    --radius-lg: 12px;
    --radius: 8px;
    --radius-sm: 4px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(108, 92, 231, 0.15);
    --shadow-glow: 0 0 20px rgba(108, 92, 231, 0.3);
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Utilities */
.hidden {
    display: none !important;
}

.w-full {
    width: 100%;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mt-4 {
    margin-top: 1rem;
}

.flex-1 {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.h-auto {
    height: auto !important;
}

.p-0 {
    padding: 0 !important;
}

.overflow-y {
    overflow-y: auto;
}

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

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

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

.bg-darker {
    background-color: var(--bg-darker) !important;
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* --- Layout --- */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* --- Sidebar --- */
.sidebar {
    width: 340px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.sidebar-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(108, 92, 231, 0.1) 0%, transparent 60%);
    pointer-events: none;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    z-index: 1;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    box-shadow: var(--shadow-glow);
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    margin-left: 3rem;
    font-weight: 500;
}

.sidebar-section {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.badge {
    background: var(--bg-elevated);
    color: var(--secondary);
    padding: 0.1rem 0.5rem;
    border-radius: 20px;
    font-size: 0.65rem;
    border: 1px solid var(--border);
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    background: rgba(42, 37, 85, 0.3);
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(108, 92, 231, 0.1);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.upload-icon {
    font-size: 2rem;
    color: var(--secondary);
    margin-bottom: 0.75rem;
    transition: transform 0.3s ease;
}

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

.drop-content h3 {
    color: var(--text-main);
    font-size: 1rem;
    margin-bottom: 0.25rem;
    text-transform: none;
    letter-spacing: normal;
}

.drop-content p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.drop-content p span {
    color: var(--accent);
    text-decoration: underline;
}

/* Icon List */
.icon-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-bottom: 1rem;
}

.empty-list {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.icon-item {
    display: flex;
    align-items: center;
    background: var(--bg-elevated);
    padding: 0.5rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    transition: all 0.2s;
    animation: slideIn 0.3s ease forwards;
}

.icon-item:hover {
    border-color: var(--border);
    background: rgba(108, 92, 231, 0.1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

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

.ii-preview {
    width: 32px;
    height: 32px;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    padding: 4px;
    border: 1px solid var(--border);
}

.ii-preview svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
    color: var(--secondary);
}

.ii-details {
    flex: 1;
    overflow: hidden;
}

.ii-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.ii-size {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.btn-icon-del {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.btn-icon-del:hover {
    color: var(--danger);
    background: rgba(255, 71, 87, 0.1);
}

.sidebar-footer {
    padding: 1.5rem;
    background: var(--bg-surface);
}

.keyboard-help {
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-muted);
}

kbd {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 4px;
    font-family: var(--font-main);
    color: var(--text-main);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

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

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 6px 15px rgba(108, 92, 231, 0.4);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: white;
    border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border);
}

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border-color: var(--border);
}

.btn-outline:hover:not(:disabled) {
    background: var(--bg-elevated);
    border-color: var(--secondary);
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-text:hover:not(:disabled) {
    text-decoration: underline;
}

.btn-icon {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* --- Workspace --- */
.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: radial-gradient(circle at top right, rgba(253, 121, 168, 0.05) 0%, transparent 60%), var(--bg-dark);
}

.toolbar {
    height: 72px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    flex-shrink: 0;
    z-index: 5;
    background: rgba(13, 11, 30, 0.8);
}

.workspace-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.toolbar-actions {
    display: flex;
    gap: 1rem;
}

.content-scroll {
    flex: 1;
    overflow: auto;
    padding: 2rem;
}

/* Output Grid */
.output-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 2rem;
    height: 100%;
    min-height: 500px;
}

.output-side {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.output-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.card-sprite {
    height: 100%;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.byte-size {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-code);
    background: var(--bg-elevated);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
}

.card-body {
    flex: 1;
    overflow: auto;
    padding: 1.5rem;
    position: relative;
    background: var(--bg-darker);
}

pre {
    margin: 0;
    width: 100%;
}

code {
    font-family: var(--font-code);
    font-size: 0.8rem;
    color: var(--secondary);
    line-height: 1.6;
    display: block;
    padding: 1.5rem;
    white-space: pre;
}

code.language-xml {
    color: #A29BFE;
}

code.language-html {
    color: #FD79A8;
}

.help-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Visual Preview Grid */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 1rem;
    align-content: start;
}

.empty-preview {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    font-size: 0.875rem;
}

.preview-item {
    width: 48px;
    height: 48px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    cursor: help;
}

.preview-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(253, 121, 168, 0.2);
}

.preview-item svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    color: var(--text-main);
    transition: color 0.2s;
}

.preview-item:hover svg {
    color: var(--accent);
}

/* Tooltip for visually inspecting name */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    background: var(--bg-darker);
    color: white;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s;
    border: 1px solid var(--border);
    z-index: 100;
}

.tooltip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .output-grid {
        grid-template-columns: 1fr;
    }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-surface);
    border: 1px solid var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    font-weight: 500;
    font-size: 0.875rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), var(--shadow-glow);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    pointer-events: none;
}

.toast.error {
    border-color: var(--danger);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 71, 87, 0.3);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}