/* Typestor - Brand Asset Management System */
/* Based on dark-first monochromatic design system */

@import url("https://fonts.googleapis.com/css2?family=Lexend:wght@300;400;500;600;700&display=swap");

:root {
    /* Background Layers */
    --bg-primary: #0a0a0a;
    --bg-secondary: #121212;
    --bg-tertiary: #1e1e1e;
    --bg-quaternary: #2a2a2a;
    --bg-hover: #333333;

    /* Text Hierarchy */
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-muted: #a0a0a0;
    --text-disabled: #666666;

    /* Accent & Status Colors */
    --accent: #4a90e2;
    --accent-hover: #357abd;
    --accent-light: rgba(74, 144, 226, 0.1);

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;

    /* Border System */
    --border: #333333;
    --border-light: #404040;
    --border-focus: var(--accent);

    /* Border Radius */
    --radius: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;

    /* Shadows */
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-focus: 0 0 0 3px var(--accent-light);

    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family:
        "Lexend",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Roboto",
        "Oxygen",
        "Ubuntu",
        "Cantarell",
        sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    background: var(--bg-primary);
    min-height: 100vh;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 1.75rem;
}
h2 {
    font-size: 1.35rem;
}
h3 {
    font-size: 1.15rem;
}

/* Header */
.header {
    background: rgba(18, 18, 18, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

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

.nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav a {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
}

.nav a:hover {
    color: var(--text-primary);
}

.nav a.active {
    color: var(--accent);
}

/* API Access Selector */
.api-access-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.api-access-selector:hover {
    border-color: var(--accent);
}

.api-access-selector iconify-icon {
    color: var(--accent);
}

.api-access-selector select {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    padding: 0;
}

.api-access-selector select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

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

.btn-icon {
    padding: 8px;
    background: transparent;
    border: 1px solid transparent;
}

.btn-icon:hover {
    background: var(--bg-hover);
}

/* Cards */
.card {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #0f0f0f 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--border-light),
        transparent
    );
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--border-light);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

/* Brand Grid */
.brand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.brand-card {
    cursor: pointer;
}

.brand-card-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.brand-color-preview {
    width: 100%;
    height: 80px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.brand-color-preview::after {
    content: attr(data-color);
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-primary);
}

.brand-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.brand-stat {
    text-align: center;
}

.brand-stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.brand-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.active {
    background: linear-gradient(
        135deg,
        rgba(16, 185, 129, 0.18),
        rgba(16, 185, 129, 0.1)
    );
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: var(--success);
}

.status-badge.draft {
    background: linear-gradient(
        135deg,
        rgba(245, 158, 11, 0.18),
        rgba(245, 158, 11, 0.1)
    );
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--warning);
}

.status-badge.archived {
    background: linear-gradient(
        135deg,
        rgba(156, 163, 175, 0.18),
        rgba(156, 163, 175, 0.1)
    );
    border: 1px solid rgba(156, 163, 175, 0.35);
    color: #9ca3af;
}

.status-badge.review {
    background: linear-gradient(
        135deg,
        rgba(74, 144, 226, 0.18),
        rgba(74, 144, 226, 0.1)
    );
    border: 1px solid rgba(74, 144, 226, 0.35);
    color: var(--accent);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--shadow-focus);
    background: var(--bg-quaternary);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    margin-top: 0.5rem;
    font-size: 12px;
    color: var(--text-muted);
}

/* Edit Brand Page */
.brand-edit-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
}

.brand-sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.brand-info-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.brand-name {
    font-size: 1.35rem;
    margin-bottom: 0.5rem;
}

.brand-id {
    color: var(--text-muted);
    font-size: 12px;
    font-family: "Courier New", monospace;
    margin-bottom: 1rem;
}

.brand-meta {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.brand-meta-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

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

.brand-meta-value {
    color: var(--text-primary);
    font-weight: 500;
}

.brand-actions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Asset Sections */
.asset-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.asset-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.asset-section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.15rem;
}

.asset-count {
    background: var(--bg-quaternary);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Asset Grid */
.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.asset-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: var(--transition);
    cursor: grab;
    user-select: none;
}

.asset-item:active {
    cursor: grabbing;
}

.asset-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--border-light);
}

.asset-thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg-quaternary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

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

.asset-item:hover .asset-thumbnail img {
    transform: scale(1.05);
}

.asset-thumbnail iconify-icon {
    font-size: 48px;
    color: var(--text-muted);
}

.asset-info {
    padding: 0.75rem;
}

.asset-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asset-size {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.asset-actions {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 2rem;
    text-align: center;
    background: var(--bg-tertiary);
    transition: var(--transition);
    cursor: pointer;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-light);
}

.upload-zone iconify-icon {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.upload-zone-text {
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 0.5rem;
}

.upload-zone-hint {
    color: var(--text-muted);
    font-size: 12px;
}

.upload-zone input[type="file"] {
    display: none;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state iconify-icon {
    font-size: 64px;
    color: var(--text-muted);
    opacity: 0.5;
    margin-bottom: 1rem;
}

.empty-state-text {
    color: var(--text-muted);
    font-size: 14px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px) scale(0.96);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Loading Spinner */
.spinner {
    animation: spin 1s linear infinite;
}

/* Settings Page - Properties List */
.properties-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.property-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.property-item:hover {
    border-color: var(--border-light);
    background: var(--bg-quaternary);
}

.property-info {
    flex: 1;
}

.property-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.required-badge {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: var(--danger);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.property-meta {
    display: flex;
    gap: 1rem;
    font-size: 12px;
}

.property-key {
    color: var(--text-muted);
    font-family: "Courier New", monospace;
}

.property-type {
    color: var(--info);
    text-transform: capitalize;
}

.property-actions {
    display: flex;
    gap: 0.25rem;
}

.card-body {
    padding: 0;
}

/* Custom Fields in Brand Forms */
.custom-fields-section {
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.custom-fields-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

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

    .brand-sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header {
        padding: 1rem;
    }

    .brand-grid {
        grid-template-columns: 1fr;
    }

    .asset-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .page-header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* Color Palette System */
.brand-color-palette {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.palette-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.palette-row-label {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    width: 20px;
}

.palette-color {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-xs);
    border: none;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.palette-color:hover {
    transform: scale(1.15);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.3),
        0 0 0 2px var(--accent);
}

.palette-color::after {
    content: attr(data-role-initial);
    position: absolute;
    bottom: -1px;
    right: -1px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 3px;
    border-radius: 2px;
    text-transform: uppercase;
    line-height: 1;
}

/* Enhanced Color Palette Input */
.enhanced-color-palette {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.enhanced-color-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.75rem;
    align-items: start;
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.enhanced-color-item:hover {
    border-color: var(--border-light);
    background: var(--bg-quaternary);
}

.enhanced-color-preview {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.enhanced-color-swatch {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-xs);
    border: none;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.1) inset,
        0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: var(--transition);
}

.enhanced-color-swatch:hover {
    transform: scale(1.05);
}

.enhanced-color-fields {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.enhanced-color-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0.5rem;
    align-items: center;
}

.enhanced-color-row label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.enhanced-color-row select,
.enhanced-color-row input[type="color"] {
    padding: 0.375rem 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: 0.75rem;
    cursor: pointer;
}

.enhanced-color-row input[type="color"] {
    width: 60px;
    height: 32px;
    padding: 2px;
    border: none;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.1) inset,
        0 2px 4px rgba(0, 0, 0, 0.2);
}

.enhanced-color-row input[type="color"]:hover {
    box-shadow:
        0 0 0 2px var(--accent),
        0 2px 8px rgba(0, 0, 0, 0.3);
}

.enhanced-color-variants {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.enhanced-color-variant {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.enhanced-color-variant label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.enhanced-color-variant-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.enhanced-color-variant input[type="color"] {
    width: 100%;
    height: 36px;
    padding: 2px;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.1) inset,
        0 2px 4px rgba(0, 0, 0, 0.2);
}

.enhanced-color-variant input[type="color"]:hover {
    box-shadow:
        0 0 0 2px var(--accent),
        0 2px 8px rgba(0, 0, 0, 0.3);
}

.enhanced-color-remove {
    padding: 0.5rem;
}

.color-role-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.color-palette-inputs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.color-input {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: var(--transition);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.1) inset,
        0 2px 8px rgba(0, 0, 0, 0.2);
}

.color-input:hover {
    transform: scale(1.05);
    box-shadow:
        0 0 0 2px var(--accent),
        0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Brand URL */
.brand-url {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
    font-size: 12px;
    color: var(--text-muted);
}

.brand-url a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

.brand-url a:hover {
    color: var(--accent-hover);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    z-index: 3000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-error {
    background: #dc3545;
    border-color: #c82333;
    color: #fff;
}

/* Sortable States */
.sortable-ghost {
    opacity: 0.4;
    filter: blur(1px);
    transition: opacity 0.15s ease, filter 0.15s ease;
}

.sortable-chosen {
    cursor: grabbing !important;
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    z-index: 999;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.sortable-drag {
    opacity: 0.85;
    box-shadow: 0 10px 28px rgba(74, 144, 226, 0.25);
    transition: opacity 0.1s ease, box-shadow 0.1s ease;
}

.sortable-fallback {
    opacity: 0.7;
}

/* Global dragging state */
body.is-dragging-asset {
    cursor: grabbing !important;
}

body.is-dragging-asset * {
    cursor: grabbing !important;
}

body.is-dragging-asset [data-root-dropzone] {
    cursor: copy !important;
}

.brand-card {
    cursor: grab;
}

.brand-card:active {
    cursor: grabbing;
}

/* Asset Properties Modal */
#assetPropertiesModal .modal {
    max-width: 600px;
}

/* Social Media Fields */
.social-links-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 768px) {
    .social-links-grid {
        grid-template-columns: 1fr;
    }
}

/* Description Field with AI Button */
.description-with-ai {
    position: relative;
}

.description-with-ai .btn {
    margin-top: 0.5rem;
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Meta Section */
.meta-section {
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.meta-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Asset Context Menu */
.asset-context-menu {
    position: absolute;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    z-index: 1000;
    min-width: 150px;
}

.context-menu-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 14px;
}

.context-menu-item:hover {
    background: var(--bg-tertiary);
}

/* Enhanced Empty States */
.empty-state.large {
    padding: 5rem 2rem;
}

.empty-state.large iconify-icon {
    font-size: 96px;
}

/* API Keys Section */
.api-keys-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.api-keys-list {
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.api-keys-list::-webkit-scrollbar {
    width: 6px;
}

.api-keys-list::-webkit-scrollbar-track {
    background: transparent;
}

.api-keys-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.api-keys-list::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* View Toggle */
.view-toggle {
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
    gap: 2px;
}

.view-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.view-toggle-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.view-toggle-btn.active {
    background: var(--accent);
    color: #ffffff;
}

/* Brand Table View */
.brand-table-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.brand-table {
    width: 100%;
    border-collapse: collapse;
}

.brand-table thead {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.brand-table th {
    padding: 1rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
    position: relative;
}

.brand-table th:hover {
    background: var(--bg-quaternary);
    color: var(--accent);
}

.brand-table th.sortable::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 0.5rem;
    vertical-align: middle;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid var(--text-muted);
    opacity: 0.3;
    transition: var(--transition);
}

.brand-table th.sortable.sort-asc::after {
    border-top: 4px solid var(--accent);
    border-bottom: none;
    opacity: 1;
}

.brand-table th.sortable.sort-desc::after {
    border-top: none;
    border-bottom: 4px solid var(--accent);
    opacity: 1;
}

.brand-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
}

.brand-table tbody tr:last-child {
    border-bottom: none;
}

.brand-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.brand-table td {
    padding: 1rem;
    vertical-align: middle;
}

.brand-table-logo {
    width: 60px;
}

.brand-table-logo img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: var(--radius-xs);
    background: var(--bg-quaternary);
    padding: 0.25rem;
}

.logo-placeholder {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-quaternary);
    border-radius: var(--radius-xs);
    color: var(--text-muted);
}

.brand-table-name-text {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.brand-table-id {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: "Courier New", monospace;
}

.brand-table-link {
    color: var(--accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    transition: var(--transition);
}

.brand-table-link:hover {
    color: var(--accent-hover);
}

.brand-table-palette .brand-color-palette {
    justify-content: flex-start;
}

.brand-table-assets {
    white-space: nowrap;
}

.brand-table-actions {
    width: 100px;
}

input[type="color"] {
    position: relative;
    width: 37px;
    height: 15px;
    border-radius: 4px;
    padding: 0;
    border: 0px solid #ffffff;
    overflow: hidden;
}

input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 3px;
    overflow: hidden;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 3px;
    overflow: hidden;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
}

input[type="color"]::after {
    content: "";
    display: block;
    position: absolute;
    left: 0px;
    top: 0px;
    width: 37px;
    height: 15px;
    border-radius: 4px;
    padding: 0;
    border: 0px solid #ffffff;
}

input[type="color"]:disabled {
    filter: grayscale(100%);
}

@media (max-width: 1024px) {
    .brand-table {
        font-size: 0.875rem;
    }

    .brand-table th,
    .brand-table td {
        padding: 0.75rem;
    }
}

/* Dropdown Button */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 8px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--radius-xs);
}

.dropdown-toggle:hover {
    background: var(--bg-hover);
}

.dropdown-toggle iconify-icon:last-child {
    font-size: 12px;
    transition: var(--transition);
}

.dropdown.active .dropdown-toggle iconify-icon:last-child {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    min-width: 180px;
    z-index: 10000;
    display: none;
    margin-top: 0.25rem;
    opacity: 0;
    transform: translateY(-8px) scale(0.95);
    transition:
        opacity 0.15s ease,
        transform 0.15s ease;
    width: min-content;
}

.dropdown.active .dropdown-menu,
.dropdown-menu.active {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    white-space: nowrap;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.dropdown-item iconify-icon {
    color: var(--text-muted);
    transition: var(--transition);
}

.dropdown-item:hover iconify-icon {
    color: var(--accent);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

.dropdown-item.primary {
    color: var(--text-primary);
    font-weight: 500;
}

.dropdown-item.primary iconify-icon {
    color: var(--accent);
}

/* ===== Folder Styles ===== */

.folder-item {
    background: var(--bg-secondary);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    cursor: grab;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    user-select: none;
}

.folder-item:active {
    cursor: grabbing;
}

.folder-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.folder-thumbnail {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    width: 100%;
    height: 120px;
}

.folder-count {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    background: var(--accent);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-xs);
    font-size: 0.75rem;
    font-weight: 600;
}

.folder-info {
    width: 100%;
    text-align: center;
    margin-top: 0.5rem;
}

.folder-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    word-break: break-word;
    font-size: 0.875rem;
}

.folder-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    margin-top: 0.5rem;
}

.folder-item:hover .folder-actions {
    opacity: 1;
}

/* Drag and Drop States */
.sortable-ghost {
    opacity: 0.4;
}

.sortable-drag {
    opacity: 0.8;
}

/* Visual feedback when dragging asset over folder */
.folder-item.folder-drag-over {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--accent-light, rgba(74, 144, 226, 0.1)) 0%, var(--accent-lighter, rgba(74, 144, 226, 0.05)) 100%);
    transform: scale(1.03);
    box-shadow: 0 8px 16px rgba(74, 144, 226, 0.25);
    transition: all 0.15s ease;
}

.folder-item.folder-drag-over .folder-thumbnail iconify-icon {
    color: var(--accent);
    animation: pulse-smooth 0.6s ease-in-out infinite;
}

@keyframes pulse-smooth {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.9; }
}

/* Make sure asset grid supports drag and drop */
.asset-grid[data-type] {
    position: relative;
}
