/* RMA CDN Filedrop - Styles */

:root {
    --primary: #e30613;
    --primary-dark: #b8050f;
    --primary-light: #ff1a27;
    --success: #34a853;
    --error: #c8102e;
    --warning: #f9ab00;
    --bg: #f5f5f5;
    --card-bg: #ffffff;
    --text: #1a1a1a;
    --text-secondary: #666666;
    --border: #e0e0e0;
    --radius: 4px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* Main Navigation */
.main-nav {
    background: var(--card-bg);
    border-bottom: 3px solid var(--primary);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-logo {
    height: 32px;
    width: auto;
}

.nav-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.nav-link:hover {
    background: var(--bg);
}

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

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.nav-username {
    font-weight: 500;
    color: var(--text);
}

.nav-logout {
    padding: 6px 12px;
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: background 0.2s;
}

.nav-logout:hover {
    background: var(--bg);
}

.nav-profile-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--text-secondary);
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.nav-profile-link:hover {
    background: var(--bg);
    color: var(--primary);
}

/* Admin Debug Dropdown */
.nav-user-dropdown {
    position: relative;
}

.nav-username-admin {
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.nav-username-admin:hover {
    background: var(--bg);
}

.debug-badge {
    display: inline-block;
    background: var(--warning);
    color: #000;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
    text-transform: uppercase;
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    z-index: 200;
    max-height: 400px;
    overflow-y: auto;
}

.nav-user-dropdown:hover .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-item {
    display: block;
    padding: 8px 12px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
}

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

.dropdown-item.active {
    background: var(--primary);
    color: white;
}

.dropdown-item-external {
    display: flex;
    align-items: center;
    color: var(--primary);
}

.dropdown-item-external:hover {
    background: var(--primary-bg);
}

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

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    background: var(--card-bg);
    padding: 48px;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.login-box .logo {
    max-width: 180px;
    height: auto;
    margin-bottom: 24px;
}

.login-box h1 {
    margin-bottom: 8px;
    font-size: 24px;
    color: var(--primary);
    font-weight: 700;
}

.login-box p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, box-shadow 0.2s;
}

.btn-microsoft {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
    width: 100%;
}

.btn-microsoft:hover {
    background: #f1f3f4;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
    margin-top: 24px;
}

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

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

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

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

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

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

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

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

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

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

.btn-icon.btn-danger:hover {
    background: rgba(200,16,46,0.1);
    color: var(--error);
}

/* App Container */
.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 24px;
    border-bottom: 3px solid var(--primary);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    height: 36px;
    width: auto;
}

.header h1 {
    font-size: 20px;
    color: var(--primary);
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

/* Main Content */
.main {
    background: var(--card-bg);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.page-title {
    font-size: 24px;
    margin-bottom: 24px;
    color: var(--text);
}

.form-section {
    margin-bottom: 24px;
}

.form-section-inline {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.form-section h2 {
    font-size: 16px;
    margin-bottom: 12px;
}

.form-section label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-section small {
    display: block;
    color: var(--text-secondary);
    margin-top: 4px;
    font-size: 13px;
}

.www2-folder-select {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.www2-folder-select label {
    margin-bottom: 6px;
}

.www2-folder-select .form-select {
    width: 100%;
}

.single-folder-label {
    font-size: 14px;
    color: var(--text);
}

.single-folder-label strong {
    color: var(--primary);
}

input[type="text"],
.form-select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    background: var(--card-bg);
}

input[type="text"]:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(227,6,19,0.2);
}

/* Path Preview */
.path-preview {
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius);
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Radio Group */
/* Compact Upload Header */
.upload-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.target-selector {
    display: flex;
    gap: 4px;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 4px;
}

.target-option {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.target-option input {
    position: absolute;
    opacity: 0;
}

.target-option:hover {
    color: var(--text);
}

.target-option.active {
    background: var(--primary);
    color: white;
}

.single-target-label {
    display: flex;
    align-items: center;
}

.target-badge {
    display: inline-block;
    padding: 8px 14px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
}

.upload-options {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.form-select-sm {
    padding: 8px 12px;
    font-size: 13px;
    min-width: 140px;
    width: auto;
}

.www2-single-badge {
    padding: 6px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
}

.compact-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
    white-space: nowrap;
}

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

.compact-checkbox:has(input:checked) {
    background: rgba(227,6,19,0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.compact-checkbox input {
    display: none;
}

.compact-checkbox .checkbox-mark {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-radius: 3px;
    position: relative;
    transition: all 0.15s;
}

.compact-checkbox:has(input:checked) .checkbox-mark {
    background: var(--primary);
    border-color: var(--primary);
}

.compact-checkbox:has(input:checked) .checkbox-mark::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.btn-browse-compact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-browse-compact:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.path-preview-inline {
    margin-left: auto;
    padding: 6px 12px;
    background: var(--bg);
    border-radius: var(--radius);
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

/* Legacy radio group (keep for backwards compatibility) */
.radio-group {
    display: flex;
    gap: 16px;
}

.radio-label {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.2s;
}

.radio-label:has(input:checked) {
    border-color: var(--primary);
    background: rgba(227,6,19,0.05);
}

.radio-label input {
    position: absolute;
    opacity: 0;
}

.radio-label span {
    font-weight: 600;
    font-size: 18px;
}

.radio-label small {
    margin-top: 4px;
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

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

.checkbox-label:has(input:checked) {
    border-color: var(--primary);
    background: rgba(227,6,19,0.05);
}

.checkbox-label input {
    position: absolute;
    opacity: 0;
}

.checkbox-box {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    margin-top: 2px;
}

.checkbox-box svg {
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s;
    color: white;
}

.checkbox-label:has(input:checked) .checkbox-box {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-label:has(input:checked) .checkbox-box svg {
    opacity: 1;
    transform: scale(1);
}

.checkbox-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.checkbox-text strong {
    font-size: 14px;
}

.checkbox-text small {
    color: var(--text-secondary);
    font-size: 12px;
}

/* Settings badge highlight */
.settings-badge-highlight {
    background: rgba(227,6,19,0.1);
    border-color: var(--primary);
}

.settings-badge-highlight .settings-value {
    color: var(--primary);
}

/* Dropzone */
.dropzone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 30px 20px;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--primary);
    background: rgba(227,6,19,0.05);
}

.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.dropzone-content {
    pointer-events: none;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.dropzone-content svg {
    opacity: 0.5;
}

.dropzone-content p {
    margin: 0;
    font-size: 14px;
}

.dropzone-content small {
    display: none;
}

.btn-folder {
    pointer-events: auto;
    font-size: 12px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-folder svg {
    margin: 0;
    opacity: 1;
}

/* File List */
.file-list {
    margin-top: 16px;
}

.file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--primary-bg);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.file-count {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.btn-clear-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text-secondary);
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-clear-all:hover {
    color: var(--error);
    border-color: var(--error);
    background: rgba(234,67,53,0.05);
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.file-name {
    font-weight: 500;
    word-break: break-all;
    flex: 1;
    min-width: 0;
}

.file-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.file-size {
    color: var(--text-secondary);
    white-space: nowrap;
    font-size: 13px;
}

.btn-remove-file {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.btn-remove-file:hover {
    background: rgba(234,67,53,0.1);
    color: var(--error);
}

.file-item-error {
    background: rgba(200,16,46,0.1);
    border: 1px solid var(--error);
}

.file-item-error .file-name,
.file-item-error .file-size {
    color: var(--error);
}

.file-error {
    color: var(--error);
    font-weight: 500;
}

.file-item-total {
    background: var(--border);
    margin-top: 4px;
}

/* Upload Result */
.upload-result {
    margin-top: 24px;
}

.alert {
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.alert-success {
    background: rgba(52,168,83,0.1);
    border: 1px solid var(--success);
    color: #1e7e34;
}

.alert-error {
    background: rgba(234,67,53,0.1);
    border: 1px solid var(--error);
    color: #c62828;
}

.alert strong {
    display: block;
    margin-bottom: 8px;
}

.alert ul {
    margin: 0;
    padding-left: 20px;
}

.alert li {
    margin: 4px 0;
}

/* Spinner */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-flex;
}

.htmx-request .btn-text {
    display: none;
}

.spinner {
    animation: spin 1s linear infinite;
}

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

/* Processing Status */
.processing-status {
    margin-top: 24px;
}

.status-container {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 20px;
}

.status-container h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text);
}

.status-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.status-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border-left: 4px solid var(--border);
}

.status-item.status-pending {
    border-left-color: var(--text-secondary);
}

.status-item.status-processing {
    border-left-color: var(--primary);
}

.status-item.status-completed {
    border-left-color: var(--success);
}

.status-item.status-error {
    border-left-color: var(--error);
}

.status-item.status-skipped {
    border-left-color: var(--warning);
}

.status-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-pending .status-icon {
    color: var(--text-secondary);
}

.status-processing .status-icon {
    color: var(--primary);
}

.status-completed .status-icon {
    color: var(--success);
}

.status-error .status-icon {
    color: var(--error);
}

.status-skipped .status-icon {
    color: var(--warning);
}

.status-info {
    flex: 1;
    min-width: 0;
}

.status-path {
    font-weight: 500;
    word-break: break-all;
    margin-bottom: 4px;
}

.status-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.status-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.savings {
    display: inline-block;
    background: rgba(52,168,83,0.1);
    color: var(--success);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
}

.cdn-link {
    display: block;
    color: var(--primary);
    word-break: break-all;
    font-size: 14px;
    margin-bottom: 8px;
}

.cdn-link:hover {
    text-decoration: underline;
}

.copy-btn {
    padding: 6px 12px;
    font-size: 13px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

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

.status-error-msg {
    color: var(--error);
    font-size: 14px;
    margin-top: 8px;
}

/* File Browser (Controlling) */
.file-browser {
    margin-top: 24px;
}

/* Bulk Actions Bar */
.bulk-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 16px;
    gap: 16px;
}

.bulk-actions-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.bulk-actions-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.select-all-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
    padding: 0;
    border: none;
    background: none;
}

.select-all-label input[type="checkbox"] {
    position: relative;
    opacity: 1;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

.selected-count {
    font-size: 14px;
    color: var(--text-secondary);
}

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

.btn-sm svg {
    width: 16px;
    height: 16px;
}

/* Checkbox Column */
.col-checkbox {
    width: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    overflow-x: auto;
}

.breadcrumb-item {
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
}

.breadcrumb-item:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text-secondary);
}

.breadcrumb-current {
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
}

.file-browser-content {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.file-browser-header {
    display: grid;
    grid-template-columns: 32px 1fr 100px 120px 80px;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}

.file-browser-list {
    min-height: 200px;
}

.file-browser-list .file-item {
    display: grid;
    grid-template-columns: 32px 1fr 100px 120px 80px;
    gap: 16px;
    align-items: center;
    padding: 12px 16px;
    margin: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
    cursor: default;
}

.file-browser-list .file-item:last-child {
    border-bottom: none;
}

.file-browser-list .file-item.folder {
    cursor: pointer;
}

.file-browser-list .file-item.folder:hover {
    background: var(--bg);
}

.file-browser-list .col-name {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.file-browser-list .col-name svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.file-browser-list .folder .col-name svg {
    color: var(--warning);
}

.file-browser-list .col-name span,
.file-browser-list .file-link {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-link {
    color: var(--primary);
    text-decoration: none;
}

.file-link:hover {
    text-decoration: underline;
}

.col-size,
.col-date {
    font-size: 14px;
    color: var(--text-secondary);
}

.col-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

.file-stats {
    margin-top: 12px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.loading,
.empty,
.error {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary);
}

.error {
    color: var(--error);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius);
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.modal-content h3 {
    margin-bottom: 12px;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.modal-filename {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    background: var(--bg);
    padding: 8px 12px;
    border-radius: var(--radius);
    word-break: break-all;
}

.modal-filename-list {
    background: var(--bg);
    border-radius: var(--radius);
    margin-top: 12px;
}

.modal-filename-list-scroll {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px 0;
}

.modal-filename-item {
    padding: 6px 12px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    word-break: break-all;
    border-bottom: 1px solid var(--border);
}

.modal-filename-item:last-child {
    border-bottom: none;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.modal-actions .btn {
    width: auto;
    margin-top: 0;
}

/* Notification */
.notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--text);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    animation: slideIn 0.2s ease;
    z-index: 1001;
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Message Container (No Access, Error pages) */
.message-container {
    text-align: center;
    padding: 48px 32px;
}

.message-icon {
    color: var(--warning);
    margin-bottom: 24px;
}

.message-icon.error {
    color: var(--error);
}

.message-container h1 {
    margin-bottom: 16px;
}

.message-container p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

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

.group-list {
    text-align: left;
    max-width: 400px;
    margin: 16px auto;
    padding-left: 20px;
}

.group-list li {
    margin: 8px 0;
    color: var(--text-secondary);
}

.group-list code {
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
}

.message-actions {
    margin-top: 32px;
}

.message-actions .btn {
    width: auto;
    display: inline-flex;
}

/* Formats Info Box */
.formats-info {
    margin-top: 32px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.formats-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.formats-header svg {
    color: var(--primary);
    flex-shrink: 0;
}

.api-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #e7f3ff;
    border: 1px solid #4a90d9;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    color: #1a5fb4;
    cursor: help;
}

.api-badge svg {
    color: #1a5fb4;
}

.formats-table {
    padding: 4px 0;
}

.formats-row {
    display: grid;
    grid-template-columns: 140px 120px 1fr;
    gap: 16px;
    padding: 10px 16px;
    align-items: center;
    font-size: 13px;
}

.formats-row-header {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.formats-row:not(.formats-row-header):hover {
    background: rgba(0,0,0,0.02);
}

.formats-col:last-child {
    color: var(--text-secondary);
}

.formats-target-info {
    padding: 12px 16px;
    background: var(--primary-bg);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--primary);
}

.formats-target-info strong {
    font-weight: 600;
}

.formats-settings-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--primary-bg) 0%, rgba(224, 224, 224, 0.3) 100%);
    border-bottom: 1px solid var(--border);
}

.settings-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.settings-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.settings-value {
    color: var(--primary);
    font-weight: 600;
}

.formats-section-header {
    padding: 8px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(0,0,0,0.02);
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

.formats-section-header:first-of-type {
    margin-top: 0;
    border-top: none;
}

.format-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

.format-image {
    background: #e3f2fd;
    color: #1565c0;
}

.format-webp {
    background: #e8f5e9;
    color: #2e7d32;
}

.format-avif {
    background: #fff3e0;
    color: #e65100;
}

.format-gif {
    background: #fff3e0;
    color: #e65100;
}

.format-video {
    background: #f3e5f5;
    color: #7b1fa2;
}

.format-web {
    background: #fff8e1;
    color: #f57f17;
}

.format-doc {
    background: #ffebee;
    color: #c62828;
}

.format-passthrough {
    background: #eceff1;
    color: #546e7a;
}

.formats-footer {
    padding: 12px 16px;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

/* Browse Modal (Upload page) */
.browse-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.browse-modal.active {
    display: flex;
}

.browse-modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--radius);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

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

.browse-modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.browse-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-secondary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.browse-modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.browse-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.browse-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bg);
    font-size: 14px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
}

.browse-breadcrumb-item {
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.browse-breadcrumb-item:hover {
    text-decoration: underline;
}

.browse-breadcrumb-separator {
    color: var(--text-secondary);
}

.browse-breadcrumb-current {
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
}

.browse-folder-list {
    min-height: 200px;
}

.browse-folder-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.browse-folder-item:last-child {
    border-bottom: none;
}

.browse-folder-item:hover {
    background: var(--bg);
}

.browse-folder-item svg {
    flex-shrink: 0;
    color: var(--warning);
}

.browse-folder-item span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.browse-folder-item .folder-arrow {
    color: var(--text-secondary);
}

.browse-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary);
}

.browse-loading {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary);
}

.browse-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg);
}

.browse-current-path {
    flex: 1;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.browse-modal-footer .btn {
    width: auto;
    margin: 0;
}

.browse-footer-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-new-folder {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-new-folder:hover {
    background: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-new-folder svg {
    color: inherit;
}

.new-folder-input-row {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    background: #e7f3ff;
    border-top: 1px solid #4a90d9;
    align-items: center;
}

.new-folder-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: #fff;
    color: #333;
    min-width: 200px;
}

.new-folder-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.2);
}

.new-folder-input::placeholder {
    color: #999;
}

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

.browse-new-folder-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 20px;
    color: var(--primary);
}

.browse-new-folder-hint svg {
    color: var(--primary);
}

.browse-new-folder-hint small {
    font-size: 12px;
    color: var(--text-secondary);
}

.btn-browse {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-browse:hover {
    background: var(--border);
    border-color: var(--text-secondary);
}

.btn-browse svg {
    color: var(--text-secondary);
}

.subdirectory-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.subdirectory-row input[type="text"] {
    flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 20px;
        gap: 12px;
    }

    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .nav-username {
        display: none;
    }

    .upload-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .target-selector {
        width: 100%;
        justify-content: center;
    }

    .upload-options {
        flex-wrap: wrap;
        justify-content: center;
    }

    .path-preview-inline {
        margin-left: 0;
        max-width: 100%;
        text-align: center;
    }

    .file-browser-header,
    .file-browser-list .file-item {
        grid-template-columns: 32px 1fr 80px;
    }

    .col-date {
        display: none;
    }

    .col-actions {
        display: none;
    }

    .file-browser-list .file-item:hover .col-actions {
        display: flex;
    }

    .bulk-actions {
        flex-wrap: wrap;
    }

    .bulk-actions-left,
    .bulk-actions-right {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 600px) {
    .header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .radio-group {
        flex-direction: column;
    }

    .main {
        padding: 20px;
    }

    .status-item {
        flex-direction: column;
    }

    .file-browser-header {
        display: none;
    }

    .file-browser-list .file-item {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .file-browser-list .col-checkbox {
        width: 24px;
    }

    .file-browser-list .col-name {
        flex: 1 1 calc(100% - 32px);
    }

    .file-browser-list .col-size {
        font-size: 13px;
    }

    .bulk-actions-left span {
        display: none;
    }

    /* Formats table responsive */
    .formats-row {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .formats-row-header {
        display: none;
    }

    .formats-col:last-child {
        grid-column: 1 / -1;
        font-size: 12px;
    }
}

/* ============================================================================
   Admin Settings Page
   ============================================================================ */

.admin-settings {
    max-width: 1000px;
}

.settings-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 24px;
}

.settings-header {
    margin-bottom: 20px;
}

.settings-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.settings-header h2 svg {
    color: var(--primary);
}

.settings-description {
    color: var(--text-secondary);
    font-size: 14px;
}

/* API Cards */
.api-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.api-card {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.api-card-active {
    border-color: var(--primary);
    background: rgba(227, 6, 19, 0.02);
}

.api-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.api-name {
    font-size: 18px;
    font-weight: 600;
}

.api-badge {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.api-badge-active {
    background: var(--success);
    color: white;
}

.api-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.api-details {
    font-size: 13px;
    margin-bottom: 16px;
}

.api-details > div {
    margin-bottom: 8px;
}

.api-details strong {
    color: var(--text-secondary);
}

.api-formats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.format-tag {
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.api-select-btn {
    width: 100%;
}

/* Optimization Profiles */
.profile-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.profile-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.profile-header {
    background: var(--bg);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.profile-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    margin: 0;
}

.profile-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.profile-form {
    padding: 20px;
}

.profile-form .form-group {
    margin-bottom: 16px;
}

.profile-form .form-group:last-child {
    margin-bottom: 0;
}

.profile-form label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s;
}

.form-select:hover {
    border-color: var(--text-secondary);
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-hint {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.profile-status {
    padding: 0 20px 16px;
    min-height: 24px;
    font-size: 13px;
}

.status-saving {
    color: var(--warning);
}

.status-saved {
    color: var(--success);
}

.status-error {
    color: var(--error);
}

/* Debug Context */
.debug-context-grid {
    display: grid;
    gap: 20px;
}

.debug-group h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.debug-buttons {
    display: flex;
    gap: 8px;
}

.debug-buttons-wrap {
    flex-wrap: wrap;
}

.btn-debug {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-debug:hover {
    background: var(--border);
}

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

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

.debug-current {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 14px;
}

.debug-context-badge {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
    margin-left: 8px;
}

/* GCP Links */
.gcp-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.gcp-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: background 0.15s;
}

.gcp-link:hover {
    background: var(--border);
}

.gcp-link svg {
    color: var(--primary);
    flex-shrink: 0;
}

.gcp-link span {
    display: flex;
    flex-direction: column;
}

.gcp-link strong {
    font-size: 14px;
}

.gcp-link small {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .api-cards {
        grid-template-columns: 1fr;
    }

    .debug-buttons {
        flex-direction: column;
    }

    .btn-debug {
        width: 100%;
        text-align: center;
    }

    .gcp-links {
        grid-template-columns: 1fr;
    }
}

/* App Footer */
.app-footer {
    margin-top: auto;
    padding: 16px 24px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-credit {
    color: var(--text-secondary);
    font-size: 13px;
}

.footer-version {
    display: inline-block;
    padding: 4px 10px;
    background: var(--primary-bg);
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.footer-version:hover {
    background: var(--primary);
    color: white;
}

/* Changelog Modal */
.changelog-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.changelog-modal.active {
    display: block;
}

.changelog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.changelog-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

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

.changelog-header h3 {
    margin: 0;
    font-size: 18px;
}

.changelog-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.changelog-close:hover {
    background: var(--bg);
    color: var(--text);
}

.changelog-body {
    padding: 20px;
    overflow-y: auto;
}

.changelog-version {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.changelog-version:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.changelog-version h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
    color: var(--primary);
}

.changelog-date {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 13px;
}

.changelog-version ul {
    margin: 0;
    padding-left: 20px;
}

.changelog-version li {
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}

.changelog-version li:last-child {
    margin-bottom: 0;
}

/* ============================================================================
   Directory Management
   ============================================================================ */

.directory-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.directory-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.directory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.directory-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.directory-path {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    font-family: monospace;
}

.directory-name {
    font-size: 14px;
    color: var(--text-secondary);
}

.protected-badge {
    background: var(--warning);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.directory-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--border);
    color: var(--text);
}

.btn-icon.btn-danger:hover {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

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

.btn-icon:disabled:hover {
    background: var(--card-bg);
    color: var(--text-secondary);
}

.directory-details {
    padding: 16px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px 32px;
}

.directory-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.directory-detail label {
    color: var(--text-secondary);
    font-weight: 500;
}

.directory-detail-full {
    width: 100%;
}

.group-badge {
    font-family: monospace;
    font-size: 12px;
    background: var(--bg);
    padding: 4px 8px;
    border-radius: var(--radius);
}

/* Subfolders */
.directory-subfolders {
    border-top: 1px solid var(--border);
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.02);
}

.subfolder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.subfolder-header h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
}

.subfolder-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.subfolder-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}

.subfolder-name {
    font-family: monospace;
    font-weight: 600;
    min-width: 120px;
}

.subfolder-label {
    flex: 1;
    color: var(--text-secondary);
}

.subfolder-group {
    font-family: monospace;
    font-size: 11px;
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-secondary);
}

.subfolder-empty {
    color: var(--text-secondary);
    font-size: 13px;
    font-style: italic;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.modal.active {
    display: block;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-lg {
    max-width: 600px;
}

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

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

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

.modal-content form {
    padding: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.form-group input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.subfolder-info {
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: var(--radius);
    color: var(--text-secondary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Group Search */
.group-input-container {
    position: relative;
}

.group-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    z-index: 10;
}

.group-result {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.group-result:last-child {
    border-bottom: none;
}

.group-result:hover {
    background: var(--bg);
}

.group-result strong {
    display: block;
    font-weight: 500;
}

.group-result small {
    color: var(--text-secondary);
    font-size: 11px;
}

.group-result-empty {
    padding: 12px;
    color: var(--text-secondary);
    font-size: 13px;
    text-align: center;
}

/* Loading and Error states */
.loading-indicator {
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-message {
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

.error-message {
    padding: 20px;
    background: rgba(200, 16, 46, 0.1);
    color: var(--error);
    border-radius: var(--radius);
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .directory-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .directory-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .directory-details {
        flex-direction: column;
        gap: 8px;
    }

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

    .subfolder-item {
        flex-wrap: wrap;
    }

    .subfolder-group {
        width: 100%;
    }
}
