/*
  Copyright 2026 The Chromium Authors
  Use of this source code is governed by a BSD-style license that can be
  found in the LICENSE file.
 */
:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --card-border: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --danger: #ef4444;
    --warning: #eab308;
    --success: #22c55e;

    --font-main: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
}

.app-container {
    width: 100%;
    max-width: 96%;
    padding: 3rem 2rem;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

.title-text {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Groups */
#groups-container {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 2rem;
    margin-bottom: 2rem;
}

.group-card {
    flex: 1;
    min-width: 0;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 2rem;
}

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

.group-title-wrapper {
    flex: 1;
}

.group-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.baseline-badge {
    background-color: var(--accent-color);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: help;
}

.group-nickname-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--card-border);
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    font-family: var(--font-main);
    padding: 0.25rem 0;
    width: 100%;
    max-width: 400px;
    transition: border-color 0.3s ease;
}

.group-nickname-input:focus {
    outline: none;
    border-color: #6366f1;
}

.remove-group-btn {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* Data Sources Grid */
.data-sources {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .data-sources {
        /* No longer needed since it's column by default */
    }
}

.source-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px dashed var(--card-border);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.source-section.dragover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.source-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.drop-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1rem;
    min-height: 120px;
    cursor: pointer;
}

.drop-icon {
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.source-section:hover .drop-icon {
    color: #6366f1;
}

.gcs-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
    justify-content: center;
}



.btn {
    font-family: var(--font-main);
    font-weight: 500;
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    border: none;
}

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

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

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

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.secondary-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.secondary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Actions */
.actions-container {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--card-border);
}

.add-group-wrapper {
    display: flex;
    align-items: stretch;
}

.add-group-tall {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100px;
    background: transparent;
    border: 2px dashed var(--card-border);
    color: var(--text-secondary);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-group-tall:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--text-primary);
}

.add-group-tall:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.add-group-tall span {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
}

.warning-text {
    color: var(--warning);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(234, 179, 8, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.hidden {
    display: none !important;
}

/* File list */
.file-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 120px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
}

.file-name {
    word-break: break-all;
    font-family: monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-primary);
}

.remove-file {
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
}

.remove-file:hover {
    color: var(--danger);
}

/* Custom Scrollbar for file list */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 1024px) {
    #groups-container {
        flex-direction: column;
    }
}

/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
}

.modal-content {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 2rem;
}

.gcs-item {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--card-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.gcs-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}
.gcs-item:last-child {
    border-bottom: none;
}
.gcs-item.folder::before {
    content: "📁";
}
.gcs-item.file::before {
    content: "📄";
}

/* Spinner */
.loader-spinner {
    border: 3px solid rgba(255,255,255,0.1);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--danger);
    transition: .3s;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.1);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

input:checked + .toggle-slider {
    background-color: var(--success);
}

input:focus + .toggle-slider {
    box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 4px var(--accent-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Tooltip */
.tooltip-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
}

.tooltip-container .tooltip-text {
    visibility: hidden;
    width: max-content;
    max-width: 250px;
    background-color: #334155;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    position: absolute;
    z-index: 10;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.4;
    border: 1px solid var(--card-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}
