:root {
    --font-main: 'Roboto', Tahoma, Geneva, Verdana, sans-serif;
    --font-header: 'Quicksand', Tahoma, Geneva, Verdana, sans-serif;
    --font-monospace: 'Source Code Pro', Menlo, Monaco, Consolas, monospace;

    --gradient: linear-gradient(100deg, #8BB6FC, #7FD4FA);

    --container-bg: rgba(255, 255, 255, 0.97);
    --group-bg: #f7f8fc;
    --group-border: 1px solid var(--secondary-dark);

    --bg-shadow: 0 20px 60px rgba(0, 116, 233, 0.3);
    --button-shadow: 0 10px 20px rgba(0, 116, 233, 0.3);
    --input-shadow: 0 0 0 3px rgba(0, 116, 233, 0.1);

    --primary: #5990f3;
    --primary-dark: #678dcb;
    --secondary: #f0f2ff;
    --secondary-dark: #e4e8ff;
    --tertiary: #eceaf3;
    --tertiary-dark: #d9d5e8;

    --text-1: #334878;
    --text-2: #666;
    --text-3: #8a8fa6;
    --error: #d6352b;
    --success: #13ac20;

    --ui-button-gap: 8px;
}

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

body {
    font-family: var(--font-main);
    background: var(--gradient);
    color: var(--text-1);
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12px;
}

.full-width {
    flex: 1 !important;
}

.container {
    background: var(--container-bg);
    border-radius: 20px;
    box-shadow: var(--bg-shadow);
    padding: 20px;
    max-width: 500px;
    width: 100%;
}

.header {
    text-align: center;
    margin-bottom: 10px;
    font-family: var(--font-header);
}

.header h1 {
    font-size: 2em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.header h1 i {
    color: var(--primary);
    font-size: 0.95em;
}

.header p {
    color: var(--text-2);
    font-size: 0.95em;
}

.logo {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 1em;
    margin-top: 25px;
}

.app-version {
    color: var(--text-2);
    font-size: 0.82em;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: inline;
}

.lang-switcher {
    display: flex;
    justify-content: center;
    gap: var(--ui-button-gap);
    margin-top: 10px;
}

.lang-btn {
    background: none;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 1.4em;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.2s ease, border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    min-width: 58px;
}

.lang-btn:hover,
.lang-btn--active {
    opacity: 1;
    font-size: 2.5em;
}

.hidden {
    display: none !important;
}

.auth-title {
    color: var(--text-1);
    margin-bottom: 10px;
    font-weight: 600;
}

.auth-group {
    display: flex;
    gap: var(--ui-button-gap);
    align-items: stretch;
    flex-wrap: wrap;
}

.auth-group input {
    min-width: 0;
}

.auth-group input:not(.hidden),
.pairing-form input,
.admin-input {
    min-width: 0;
    flex: 1 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.auth-group input:not(.hidden):focus,
.pairing-form input:focus,
.admin-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--input-shadow);
}

.auth-group .btn-primary {
    flex: 0 0 auto;
    min-width: 120px;
}

.auth-message {
    margin-top: 10px;
    color: var(--error);
    min-height: 1.2em;
    font-size: 0.9em;
    text-align: center;
}

.controller-section .btn-settings {
    gap: 6px;
}

.controller-section {
    display:flex;
    flex-direction: column;
    gap: 30px;
}

.tenant-chip {
    background: var(--group-bg);
    border-radius: 12px;
    padding: 12px 20px;
    font-weight: 600;
    text-align: center;
    flex: 1;
}

.input-group {
    display: flex;
    gap: var(--ui-button-gap);
    align-items: stretch;
}

.btn-icon {
    flex-shrink: 0;
    padding-left: 14px;
    padding-right: 14px;
}

.column-list {
    display: flex;
    flex-direction: column;
    gap: var(--ui-button-gap);
}

.group-label {
    font-size: 0.82em;
    font-weight: 600;
    letter-spacing: 0.03em;
    margin-bottom: 12px;
}

.youtube-url-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.youtube-url-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--input-shadow);
}

.video-url-error {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    color: var(--text-2);
    margin: 0;
}

.video-url-error .fas {
    color: var(--error);
    flex-shrink: 0;
}

.buttons-list {
    display: flex;
    gap: var(--ui-button-gap);
    flex: 1;
}

.buttons-list .btn {
    flex: 1;
    min-width: 0;
}

.btn-saved-video {
    display: flex;
    align-items: center;
    gap: var(--ui-button-gap);
    width: 100%;
    padding: 8px 12px;
    background: var(--secondary);
    border: 1px solid var(--secondary-dark);
    border-radius: 8px;
    color: var(--text-1);
    font-size: 0.88em;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
    overflow: hidden;
}

.btn-saved-video:hover {
    background: var(--secondary-dark);
}

.btn-saved-video:disabled,
.btn-saved-video:disabled:hover {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--tertiary);
    color: var(--text-3);
}

.btn-saved-video--active {
    background: var(--secondary);
    border-color: var(--primary);
    color: var(--text-1);
}

.btn-saved-video--active i {
    color: var(--primary);
}

.btn-saved-video--active:hover {
    background: var(--secondary-dark);
}

.btn-saved-video i {
    flex-shrink: 0;
    color: var(--primary);
}

.btn-saved-video span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Flex label inside saved-video button so badge stays pinned to the right */
.btn-saved-video-label {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Small category badge shown on each button when All tab is active */
.saved-video-category {
    flex-shrink: 0;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--secondary);
    color: var(--primary-dark);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.75em;
    white-space: nowrap;
    border: 1px solid var(--secondary-dark);
    height: 22px;
    line-height: 1;
}

/* Category filter tab strip */
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    column-gap: 5px;
    row-gap: 4px;
}

.saved-videos-filter-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--ui-button-gap);
    margin-bottom: 12px;
}

.saved-videos-filter-row .category-tabs {
    width: 100%;
}

.saved-videos-search {
    flex: none;
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    font-family: inherit;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.saved-videos-search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--input-shadow);
}

.saved-videos-empty {
    margin: 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--secondary);
    border: 1px dashed var(--secondary-dark);
    color: var(--text-3);
    font-size: 0.88em;
    text-align: center;
}

.category-tab {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--secondary);
    color: var(--primary-dark);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.85em;
    font-family: inherit;
    cursor: pointer;
    user-select: none;
    border: 1px solid var(--secondary-dark);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    height: 26px;
    line-height: 1;
    box-sizing: border-box;
}

.category-tab:hover {
    background: var(--secondary-dark);
    border-color: var(--primary-dark);
    color: var(--text-1);
}

.category-tab--active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.category-tab--active:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

/* Save URL modal form */
.modal-title {
    font-size: 1.05em;
    font-weight: 700;
    color: var(--text-1);
    margin: 0;
}

.save-url-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    text-align: left;
}

.save-url-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.95em;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.save-url-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--input-shadow);
}

.saved-url-category-wrap {
    position: relative;
}

.cat-combo {
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    min-height: 38px;
    padding: 2px 6px 2px 8px;
    cursor: text;
    transition: border-color 0.15s;
}

.cat-combo--open,
.cat-combo:focus-within {
    border-color: #6366f1;
}

.cat-combo-field {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
}

.cat-combo-input {
    border: none;
    outline: none;
    background: transparent;
    flex: 1;
    min-width: 60px;
    font-size: 14px;
    color: #111827;
    padding: 2px 0;
}

.cat-combo-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    color: var(--text-3, #8a8fa6);
    font-size: 0.7rem;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}

.cat-combo-toggle:hover {
    color: var(--text-1, #334878);
}

.cat-combo-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    z-index: 200;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    align-items: flex-start;
    align-content: flex-start;
}

.cat-combo-empty {
    font-size: 0.8rem;
    color: var(--text-3, #8a8fa6);
    font-style: italic;
}

.cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--secondary, #f0f2ff);
    color: var(--primary-dark, #678dcb);
    border-radius: 20px;
    padding: 3px 6px 3px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    user-select: none;
    border: 1px solid var(--secondary-dark, #e4e8ff);
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.cat-chip:hover {
    background: var(--secondary-dark, #e4e8ff);
    border-color: var(--primary-dark, #678dcb);
}

.cat-chip--selected {
    cursor: default;
}

.cat-chip--selected:hover {
    background: var(--secondary, #f0f2ff);
    border-color: var(--secondary-dark, #e4e8ff);
}

.cat-chip--new {
    background: transparent;
    border: 1px dashed var(--primary-dark, #678dcb);
}

.cat-chip--new:hover {
    background: var(--secondary, #f0f2ff);
}

.cat-chip-label {
    pointer-events: none;
}

.cat-chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    padding: 0 2px;
    font-size: 0.85rem;
    line-height: 1;
    opacity: 0.6;
    display: inline-flex;
    align-items: center;
}

.cat-chip-remove:hover {
    opacity: 1;
}

@media (max-width: 600px) {
    .cat-combo {
        padding: 2px 4px 2px 6px;
        min-height: 36px;
        height: 36px;
    }

    .cat-combo-toggle {
        padding: 1px 4px;
        font-size: 0.65rem;
    }

    .cat-combo-input {
        font-size: 0.85em;
        padding: 1px 0;
    }

    .cat-combo-dropdown {
        top: calc(100% + 2px);
        padding: 8px;
        gap: 4px;
    }

    .cat-chip {
        padding: 2px 5px 2px 8px;
        font-size: 0.7rem;
        height: 20px;
        line-height: 1;
    }

    .cat-chip-remove {
        padding: 0 1px;
        font-size: 0.8rem;
    }
}

.saved-url-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    padding: 10px;
    border: 1px solid var(--secondary-dark);
    border-radius: 10px;
    background: #fff;
}

.saved-url-row-top {
    display: flex;
    align-items: center;
    gap: var(--ui-button-gap);
}

.saved-url-label {
    flex: 1 1 auto;
    min-width: 0;
}

.saved-url-url {
    width: 100%;
    min-width: 0;
}

.saved-url-category {
    width: 100%;
    min-width: 0;
}

.saved-url-row .btn-config-clear {
    align-self: center;
    flex: 0 0 auto;
}

.settings-hint {
    font-size: 0.85em;
    color: var(--text-3);
    margin-top: 6px;
}

.settings-hint-empty {
    margin-top: 8px;
}

.btn {
    color: var(--text-1);
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.95em;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease, border-color 0.3s ease;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--ui-button-gap);
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    min-width: 120px;
}

.btn-primary:hover {
    box-shadow: var(--button-shadow);
}

.btn-secondary {
    background: var(--secondary);
    border: 1px solid var(--secondary-dark);
}

.btn-secondary:hover {
    background: var(--secondary-dark);
}

.btn-tertiary {
    background: var(--tertiary);
    border: none;
    flex: 1;
}

.btn-tertiary:hover {
    background: var(--tertiary-dark);
}

.btn-primary:disabled,
.btn-primary:disabled:hover,
.btn-primary:disabled:active,
.btn-secondary:disabled,
.btn-secondary:disabled:hover {
    background: var(--tertiary);
    color: var(--text-3);
    cursor: not-allowed;
    box-shadow: none;
}

/* ── Mobile overrides ───────────────────────────────────────────────────── */

@media (max-width: 600px) {
    #tenantId,
    #accessToken,
    #adminToken {
        flex: 0 0 auto;
        width: 100%;
        max-width: 100%;
    }
}


