/* === RESET & BASE === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* === LAYOUT === */
.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app__header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
}

.app__main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* === ICON NAVIGATION (Left Rail) === */
.icon-nav {
    width: 48px;
    height: calc(100vh - var(--header-height));
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    padding: var(--space-2) 0;
    flex-shrink: 0;
}

.icon-nav__main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: 0 var(--space-1);
}

.icon-nav__bottom {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-1);
    border-top: 1px solid var(--border-primary);
    margin-top: auto;
}

.icon-nav__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: var(--radius-lg);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.icon-nav__btn:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.icon-nav__btn.active {
    background: var(--accent-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.icon-nav__btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Tooltip on hover */
.icon-nav__btn::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    padding: var(--space-2) var(--space-3);
    background: var(--text-primary);
    color: var(--text-inverse);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    border-radius: var(--radius-md);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    z-index: var(--z-tooltip);
}

.icon-nav__btn:hover::after {
    opacity: 1;
}

/* === SIDEBAR === */
.app__sidebar {
    width: 280px;
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    background: var(--surface);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar__content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
}

/* === PREVIEW === */
.app__preview {
    flex: 1;
    height: calc(100vh - var(--header-height));
    overflow: auto;
    padding: var(--space-6);
    background: var(--bg-tertiary);
}

/* === HEADER === */
.header__brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.header__powerbi-logo {
    flex-shrink: 0;
}

.header__title {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--text-primary);
}

.header__badge {
    padding: var(--space-1) var(--space-2);
    background: var(--accent-gradient);
    color: white;
    font-size: 10px;
    font-weight: var(--font-bold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-md);
}

.header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* === SECTION === */
.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn var(--transition-base);
}

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

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

.section__header {
    margin-bottom: var(--space-5);
}

.section__title {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.section__description {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
}

.section__group {
    margin-bottom: var(--space-5);
}

.section__group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.section__group-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-bottom: 0;
}

.section__group-header+.color-palette {
    margin-top: 0;
}

/* === SENTIMENT ROW === */
.sentiment-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.sentiment-label {
    width: 80px;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.sentiment-colors {
    display: flex;
    gap: var(--space-1);
}

.sentiment-colors .color-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    position: relative;
}

.sentiment-colors .color-dot:hover {
    transform: scale(1.1);
}

.sentiment-colors .color-dot.selected {
    border-color: var(--text-primary);
}

.sentiment-colors .color-dot input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* === PREVIEW === */
.preview {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.preview__header {
    padding: var(--space-3) var(--space-5);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.preview__title {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
}

.preview__content {
    flex: 1;
    overflow: auto;
    padding: var(--space-5);
}

/* === PRESET GRID === */
.preset-grid {
    display: grid;
    gap: var(--space-3);
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
}

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

/* === UTILITIES === */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}