:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border: #334155;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --sidebar-width: 250px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 2rem 0;
    padding-bottom: 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 0 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.sidebar-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-header p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.nav-menu {
    list-style: none;
    padding: 0 0.75rem;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s;
    cursor: pointer;
    font-weight: 500;
}

.nav-link:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--primary-color);
    color: white;
}

.nav-link svg {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    width: calc(100% - var(--sidebar-width));
    max-width: none;
}

.page {
    display: none;
}

.page[style*="display: block"] {
    animation: fadeIn 0.3s ease-in;
}

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

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

.page-header {
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Form Styles */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.form-input,
.form-select {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.color-picker-group {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.color-picker-wrapper {
    position: relative;
    flex: 0 0 60px;
}

.color-picker {
    width: 60px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.color-picker:hover {
    border-color: var(--primary-color);
}

.hex-input {
    flex: 1;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

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

.btn-secondary:hover {
    background: #475569;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn-icon {
    padding: 0.5rem;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Filament List */
.filament-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* List View - Default */
.filament-list.list-view {
    display: flex;
    flex-direction: column;
}

.filament-item {
    display: block;
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.filament-list.list-view .filament-item {
    display: grid !important;
    grid-template-columns: auto 1fr auto !important;
    gap: 1.5rem !important;
    align-items: center !important;
}

.filament-list.list-view .filament-details {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    gap: 1rem !important;
}

/* Filament Grid View - Compact Grid */
.filament-list.grid-view {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    gap: 0.75rem !important;
}

.filament-list.grid-view .filament-item {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
    padding: 1rem !important;
    min-height: 160px !important;
    justify-content: flex-start !important;
    align-items: center !important;
    text-align: center !important;
}

.filament-list.grid-view .filament-color-indicator {
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    margin: 0 auto 0.5rem !important;
}

.filament-list.grid-view .filament-info {
    width: 100% !important;
}

.filament-list.grid-view .filament-details {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.4rem 0.5rem !important;
    width: 100% !important;
    font-size: 0.75rem !important;
}

.filament-list.grid-view .filament-detail {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    padding: 0.25rem !important;
}

.filament-list.grid-view .filament-detail-label {
    color: var(--text-secondary) !important;
    font-size: 0.65rem !important;
    font-weight: 500 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin-bottom: 0.15rem !important;
}

.filament-list.grid-view .filament-detail-value {
    color: var(--text-primary) !important;
    font-weight: 600 !important;
    font-size: 0.8rem !important;
}

.filament-list.grid-view .filament-actions {
    width: 100% !important;
    display: flex !important;
    gap: 0.4rem !important;
    justify-content: center !important;
    margin-top: 0.5rem !important;
}

.filament-list.grid-view .filament-actions .btn {
    font-size: 0.7rem !important;
    padding: 0.4rem 0.6rem !important;
}

.filament-list.grid-view .brand-link-display {
    /* display: none !important; - Removed to show brand links */
    justify-content: center;
}

.filament-list.grid-view .brand-link-url {
    display: none !important;
}

.filament-list.grid-view .filament-notes-display {
    display: none !important;
}



.filament-item:hover {
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.filament-color-indicator {
    width: 60px;
    height: 60px;
    border-radius: 0.5rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.filament-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.filament-detail {
    display: flex;
    flex-direction: column;
}

.filament-detail-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.filament-detail-value {
    font-size: 1rem;
    font-weight: 600;
}

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

/* Brand Link Display */
.brand-link-display {
    display: flex;
    width: 100%;
    margin-top: 0.5rem;
}

.brand-link-full-width {
    grid-column: 1 / -1;
    width: 100%;
}

.brand-link-url {
    flex: 1;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

/* Settings Sections */
.settings-section {
    margin-bottom: 2rem;
}

.settings-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.brand-list,
.brand-link-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.brand-item,
.brand-link-item {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
}

.brand-item-name,
.brand-link-item-name {
    flex: 1;
    font-weight: 500;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* Coming Soon */
.coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}

.coming-soon-icon {
    width: 120px;
    height: 120px;
    margin-bottom: 2rem;
    opacity: 0.6;
}

.coming-soon h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.coming-soon p {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

/* About Page */
.about-content {
    max-width: 700px;
}

.about-content h3 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.about-content p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.about-content ul {
    list-style: none;
    padding-left: 0;
}

.about-content li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
}

.about-content li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: 0.75rem;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

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

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

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

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

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

    .filament-item {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .filament-details {
        grid-template-columns: 1fr;
    }
}

/* Filament Notes Display */
.filament-notes-display {
    grid-column: 1 / -1;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.filament-notes-display .filament-detail-value {
    font-style: italic;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Brand List Views */
.brand-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

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

.brand-list.grid-view {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.brand-list.list-view {
    display: flex !important;
    flex-direction: column;
    gap: 0.5rem;
}

.brand-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s;
}

.brand-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.brand-list.grid-view .brand-item {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
    padding: 1rem;
    min-height: 120px;
    justify-content: center;
}

.brand-list.grid-view .brand-item span {
    font-weight: 600;
    font-size: 1rem;
    word-break: break-word;
}


/* Brand button layout */
.brand-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Grid view: vertical layout */
.brand-list.grid-view .brand-buttons {
    flex-direction: column;
}

/* List view: horizontal layout */
.brand-list.list-view .brand-buttons {
    flex-direction: row;
}

.brand-list.grid-view .brand-item button {
    width: 100%;
    margin-top: auto;
}

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

::-webkit-scrollbar-track {
    background: var(--background);
}

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

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