/* ==========================================================================
   FIP (First CH Internal Portal) Premium Stylesheet
   ========================================================================== */

/* Design Tokens */
:root {
    --bg-main: #0B0A13;
    --bg-sidebar: #11101E;
    --bg-card: rgba(22, 21, 38, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    
    --primary: #8F54FB;
    --primary-glow: rgba(143, 84, 251, 0.3);
    --secondary: #2C2B3E;
    
    --text-main: #F4F3F7;
    --text-muted: #8E8D9B;
    
    --green: #00E676;
    --green-glow: rgba(0, 230, 118, 0.2);
    --blue: #29B6F6;
    --blue-glow: rgba(41, 182, 246, 0.2);
    --red: #FF5252;
    --red-glow: rgba(255, 82, 82, 0.2);
    
    --font-heading: 'Outfit', 'Noto Sans JP', sans-serif;
    --font-body: 'Outfit', 'Noto Sans JP', sans-serif;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow: hidden;
    height: 100vh;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar styling */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.brand-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

.sidebar-brand h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    font-family: var(--font-heading);
}

.brand-sub {
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
    vertical-align: super;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.menu-icon {
    width: 18px;
    height: 18px;
}

.menu-item:hover, .menu-item.active {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.04);
}

.menu-item.active {
    background-color: var(--primary-glow);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

.badge {
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
}

.badge-alert {
    background-color: var(--red);
    color: white;
}

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

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* Main Content styling */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-header {
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    flex-shrink: 0;
}

#page-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 22px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.online {
    background-color: var(--green);
    box-shadow: 0 0 8px var(--green);
}

.status-indicator.offline {
    background-color: var(--red);
    box-shadow: 0 0 8px var(--red);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background-color: rgba(255, 255, 255, 0.04);
    border-radius: 20px;
}

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

.username {
    font-size: 13px;
    font-weight: 500;
}

/* Content Body */
.content-body {
    flex-grow: 1;
    padding: 32px;
    overflow-y: auto;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Glassmorphism Cards */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

/* Metric grid */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.metric-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
}

.metric-label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: block;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-heading);
}

.text-green { color: var(--green); }
.text-red { color: var(--red); }

.metric-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bg-purple { background-color: var(--primary-glow); color: var(--primary); }
.bg-green { background-color: var(--green-glow); color: var(--green); }
.bg-blue { background-color: var(--blue-glow); color: var(--blue); }

/* Dashboard layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
}

.grid-card {
    display: flex;
    flex-direction: column;
}

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

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 24px;
    flex-grow: 1;
}

/* AI Pipeline step styling */
.pipeline-flow {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.pipeline-step {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.step-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
}

.step-count {
    color: var(--text-muted);
}

.progress-bar-container {
    height: 8px;
    background-color: rgba(255, 255, 255, 0.04);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-bar.animated {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 1rem 1rem;
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    from { background-position: 1rem 0; }
    to { background-position: 0 0; }
}

/* Lists and list items */
.pr-list-container {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.sub-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
}

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

.list-placeholder {
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
}

.pr-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
}

.pr-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pr-title {
    font-weight: 500;
    color: var(--text-main);
    text-decoration: none;
}

.pr-title:hover {
    color: var(--primary);
}

.pr-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.verify-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.verify-badge.pass { background-color: var(--green-glow); color: var(--green); }
.verify-badge.fail { background-color: var(--red-glow); color: var(--red); }

/* Batch Item Layout */
.batch-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.batch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.batch-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.indicator-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.indicator-dot.success { background-color: var(--green); box-shadow: 0 0 8px var(--green); }
.indicator-dot.alert { background-color: var(--red); box-shadow: 0 0 8px var(--red); }
.indicator-dot.pending { background-color: var(--text-muted); }

.batch-name {
    font-size: 14px;
    font-weight: 500;
}

.batch-time {
    font-size: 12px;
    color: var(--text-muted);
}

/* Kanban Board Styling */
.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    align-items: start;
}

.kanban-column {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 500px;
}

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

.column-header h4 {
    font-size: 14px;
    font-weight: 600;
}

.column-count {
    font-size: 12px;
    color: var(--text-muted);
    background-color: rgba(255, 255, 255, 0.04);
    padding: 2px 6px;
    border-radius: 10px;
}

.column-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 400px;
}

/* Kanban Cards */
.kanban-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.task-id {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
}

.task-pj {
    font-size: 11px;
    color: var(--text-muted);
}

.task-title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 12px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
}

.task-assignee {
    background-color: rgba(255, 255, 255, 0.04);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Reply Drafts Layout (T120) */
.drafts-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    height: calc(100vh - 170px);
}

.drafts-sidebar {
    padding: 20px;
    overflow-y: auto;
}

.drafts-sidebar h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
}

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

.project-menu-item {
    padding: 10px 14px;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    transition: background-color 0.2s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-menu-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.project-menu-item.active {
    background-color: var(--primary-glow);
    color: var(--primary);
    font-weight: 500;
}

.drafts-workspace {
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.workspace-empty {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
}

.placeholder-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 16px;
    stroke-width: 1.2;
}

.workspace-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.workspace-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#draft-editor-textarea {
    flex-grow: 1;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.5;
    background-color: rgba(0, 0, 0, 0.2);
    resize: none;
}

.workspace-actions {
    display: flex;
    gap: 12px;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    width: 480px;
    max-width: 90%;
    display: flex;
    flex-direction: column;
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.modal-body {
    padding: 24px;
}

.modal-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 20px;
}

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

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

.form-control {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 14px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s;
}

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

.select-sm {
    padding: 6px 12px;
    font-size: 12px;
    width: auto;
}

.form-help {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    display: block;
}

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

.connection-result {
    margin-top: 16px;
    font-size: 13px;
    font-weight: 500;
    padding: 10px;
    border-radius: 6px;
    display: none;
}

.connection-result.success { background-color: var(--green-glow); color: var(--green); }
.connection-result.fail { background-color: var(--red-glow); color: var(--red); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    font-family: inherit;
}

.btn:active {
    transform: scale(0.98);
}

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

.btn-primary:hover {
    background-color: #7b3deb;
}

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

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.btn-block {
    width: 100%;
}

.btn-icon-only {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.btn-icon-only:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
}

.btn-icon {
    width: 16px;
    height: 16px;
}

/* Gantt Screen Placeholders */
.gantt-container {
    padding: 100px 30px;
    height: 400px;
    display: flex;
    justify-content: center;
}

.gantt-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    max-width: 400px;
}

.gantt-placeholder p {
    font-size: 13px;
    margin: 8px 0 16px;
    line-height: 1.5;
}

.note-text {
    font-size: 11px;
    color: var(--primary);
}
