/* --- Root Variables & Base Reset --- */
:root {
    --bg-color: #f0f4f8;
    --header-bg: #ffffff;
    --primary-blue: #3b66f5;
    --danger-red: #ef4444;
    --success-green: #059669;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --column-bg: #f8fafc; /* Slightly lighter than background to pop out */
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --border-radius: 10px;
}

html, body {
    height: 100%; margin: 0; overflow: hidden; 
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    background-color: var(--bg-color); color: var(--text-main); line-height: 1.5;
}

/* 🔒 LOGIN PAGE STYLES */
.login-wrapper {
    display: flex; align-items: center; justify-content: center;
    height: 100vh; width: 100vw; background-color: var(--bg-color);
    position: absolute; top: 0; left: 0; z-index: 9999;
}
.login-card {
    background: #ffffff; padding: 40px 50px; border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05); text-align: center; width: 100%; max-width: 380px;
}
.login-logo { font-size: 50px; margin-bottom: 15px; }
.login-card h2 { margin: 0 0 10px 0; color: var(--text-main); font-size: 22px; font-weight: 700; }
.login-card p { color: var(--text-muted); font-size: 14px; margin-bottom: 30px; }

/* --- Header & Navigation --- */
.main-header {
    background: var(--header-bg); padding: 12px 30px; display: flex; justify-content: space-between;
    align-items: center; border-bottom: 1px solid #e2e8f0; position: relative; z-index: 100;
    height: 64px; box-sizing: border-box;
}
.logo-section { display: flex; align-items: center; gap: 10px; }
.logo-section h1 { font-size: 18px; margin: 0; font-weight: 700; color: #0f172a; }
.logo-icon { font-size: 20px; }
.header-actions { display: flex; align-items: center; gap: 15px; }
.user-info { display: flex; align-items: center; gap: 10px; border-right: 1px solid #e2e8f0; padding-right: 15px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: #e2e8f0; }
.user-text { font-size: 12px; display: flex; flex-direction: column; }
.logout-link { background: none; border: none; color: var(--text-muted); padding: 0; text-align: left; text-decoration: underline; cursor: pointer; font-size: 11px; }
.admin-controls { display: flex; gap: 10px; }

/* --- Master Layout Fix --- */
.board-container { padding: 20px 30px; height: calc(100vh - 64px); display: flex; flex-direction: column; box-sizing: border-box; }
.board-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; flex-shrink: 0; }
.board-header h2 { font-size: 22px; font-weight: 700; margin: 0; }

/* 🔍 Search Bar Styles */
.header-tools { display: flex; align-items: center; gap: 20px; }
.search-input {
    padding: 8px 15px; border: 1px solid #cbd5e1; border-radius: 20px; font-size: 13px;
    width: 250px; transition: all 0.2s ease; outline: none; background: #fff;
}
.search-input:focus { border-color: var(--primary-blue); box-shadow: 0 0 0 3px rgba(59, 102, 245, 0.1); }
.board-stats { font-size: 14px; color: var(--text-muted); font-weight: 500;}

.board { display: flex; gap: 20px; flex-grow: 1; overflow-x: auto; padding-bottom: 10px; align-items: stretch; }

/* --- Columns & List Scroll --- */
.column { 
    background-color: var(--column-bg); 
    border-radius: var(--border-radius); 
    width: 320px; 
    min-width: 320px; 
    display: flex; 
    flex-direction: column; 
    max-height: 100%; 
    /* 🟢 NEW: Clear demarcation for stages */
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}
.column-header { padding: 12px 16px; flex-shrink: 0; border-bottom: 1px solid #f1f5f9; /* Subtle line under header */ }
.column-header h3 { margin: 0; font-size: 13px; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: 0.5px; }

.card-list { padding: 10px; flex-grow: 1; overflow-y: auto; min-height: 0; }
.card-list::-webkit-scrollbar { width: 4px; }
.card-list::-webkit-scrollbar-track { background: transparent; }
.card-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
.card-list::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* --- Cards --- */
.card { background: #ffffff; border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--card-shadow); border-left: 4px solid var(--primary-blue); cursor: pointer; transition: transform 0.1s ease; border: 1px solid #e2e8f0; }
.card:hover { transform: translateY(-1px); box-shadow: 0 6px 12px -2px rgba(0, 0, 0, 0.1); }
.card-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; flex-wrap: wrap; gap: 5px;}
.card-title { font-weight: 800; font-size: 14px; color: #0f172a; margin: 0; }
.card-tags { display: flex; gap: 5px; align-items: center; }
.live-date-tag { font-size: 9px; background: #eff6ff; color: #1e40af; padding: 2px 6px; border-radius: 4px; font-weight: 700; border: 1px solid #dbeafe; }

/* ⏳ Dynamic Anti-Stuck Badges */
.stuck-badge { font-size: 9px; padding: 2px 6px; border-radius: 4px; font-weight: 700; border: 1px solid transparent; }
.stuck-normal { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }
.stuck-danger { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

.card-code { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; display: block; }
.card-metrics { background: #f8fafc; border: 1px solid #f1f5f9; border-radius: 4px; padding: 6px 8px; }
.metrics-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.metrics-table th { text-align: right; color: var(--text-muted); padding-bottom: 2px; font-weight: 500; }
.metrics-table td { text-align: right; padding: 2px 0; color: var(--success-green); font-weight: 700; }
.metrics-table td:first-child, .metrics-table th:first-child { text-align: left; color: var(--text-main); }
.trend-pill { font-size: 9px; padding: 0px 3px; border-radius: 3px; margin-left: 2px; font-weight: bold; }
.trend-up { background: #dcfce7; color: #166534; }
.trend-down { background: #fee2e2; color: #991b1b; }

/* --- Modals --- */
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); }
.modal-content { background: #fff; margin: 20px auto; padding: 25px; border-radius: 12px; width: 450px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2); position: relative; max-height: calc(100vh - 40px); overflow-y: auto; }
.large-modal { width: 850px; max-width: 95vw; }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid #f1f5f9; padding-bottom: 15px; margin-bottom: 20px; }
.close-btn { background: none; border: none; font-size: 28px; color: #94a3b8; cursor: pointer; line-height: 1; }
.modal-body { display: flex; gap: 40px; }
.details-sidebar { flex: 1; border-right: 1px solid #f1f5f9; padding-right: 30px; }
.details-main { flex: 1.5; display: flex; flex-direction: column; }
.info-block-inline { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; font-size: 14px; }
.info-block-inline strong { min-width: 70px; color: var(--text-muted); }

.sidebar-actions { margin-top: 30px; display: flex; flex-direction: column; gap: 10px; }

/* 🖌️ Modernized Forms */
.input-group { margin-bottom: 15px; width: 100%; }
.input-group label { display: block; font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; }
.input-row { display: flex; gap: 15px; }
.input-row .input-group { flex: 1; }

.input-group input, .input-group select, .info-block-inline input, .info-block-inline select { 
    width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 6px; 
    font-size: 13px; font-family: inherit; box-sizing: border-box; transition: border-color 0.2s; outline: none; color: var(--text-main);
}
.input-group input:focus, .input-group select:focus, .info-block-inline input:focus, .info-block-inline select:focus { 
    border-color: var(--primary-blue); box-shadow: 0 0 0 3px rgba(59, 102, 245, 0.1); 
}

/* --- Buttons --- */
.btn { border: none; border-radius: 6px; padding: 10px 20px; font-weight: 700; cursor: pointer; transition: all 0.2s; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; }
.btn-primary { background: var(--primary-blue); color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-secondary { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: #fff; color: var(--danger-red); border: 1px solid #fee2e2; }
.btn-danger:hover { background: var(--danger-red); color: #fff; }
.btn-full { width: 100%; }

/* --- Remarks / Audit Trail --- */
.feed { background: #f8fafc; border-radius: 8px; padding: 15px; height: 250px; overflow-y: auto; margin-bottom: 15px; border: 1px solid #f1f5f9; }
.comment-item { background: #fff; padding: 12px; border-radius: 8px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); font-size: 13px; border-left: 3px solid #cbd5e1; }
.comment-item small { display: block; color: var(--text-muted); margin-top: 6px; font-size: 10px; }
.comment-box { display: flex; flex-direction: column; gap: 10px; }
textarea { width: 100%; height: 80px; padding: 12px; border: 1px solid #cbd5e1; border-radius: 8px; box-sizing: border-box; font-family: inherit; resize: none; outline: none; transition: border-color 0.2s;}
textarea:focus { border-color: var(--primary-blue); }

/* 🛡️ SYSTEM LOG STYLE */
.comment-item.system { background: #f1f5f9; color: #64748b; font-style: italic; border-left: 3px solid #94a3b8; }

/* =========================================================
   📱 RESPONSIVE DESIGN (TABLET & MOBILE)
   ========================================================= */
@media (max-width: 768px) {
    .main-header { padding: 10px 15px; }
    .logo-section h1 { font-size: 15px; }
    .header-actions { gap: 10px; }
    .user-info { padding-right: 10px; }
    .board-container { padding: 15px; }
    .login-card { width: 90%; padding: 30px 20px; }
    .modal-content { width: 90%; padding: 15px; margin: 20px auto; }
    .large-modal { width: 95%; }
    .modal-body { flex-direction: column; gap: 20px; }
    .details-sidebar { border-right: none; border-bottom: 1px solid #f1f5f9; padding-right: 0; padding-bottom: 20px; }
}