@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #1e293b; /* modern dark slate */
    --primary-light: #334155;
    --danger: #ef4444; /* modern red */
    --success: #10b981; /* modern emerald */
    --warning: #f59e0b; /* modern amber */
    --accent: #3b82f6; /* modern blue */
    --prod: #8b5cf6; /* modern purple */
    --bg-main: #f8fafc; /* modern slate 50 */
    --text-main: #0f172a; /* slate 900 */
    --text-muted: #64748b; /* slate 500 */
    --border: #e2e8f0; /* slate 200 */
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: var(--bg-main);
    margin: 0;
    display: flex;
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Styling */
#sidebar {
    width: 380px;
    background: var(--primary);
    color: #f8fafc;
    padding: 24px;
    height: 100vh;
    overflow-y: auto;
    border-right: 4px solid var(--accent);
    box-sizing: border-box;
    flex-shrink: 0;
    padding-bottom: 80px;
    position: relative;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.05);
}

#sidebar h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 10px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#sidebar input, #sidebar select, #sidebar button {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    padding: 10px 12px;
    margin-top: 6px;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

#sidebar input:focus, #sidebar select:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

#sidebar select option {
    background: var(--primary);
    color: white;
}

#sidebar label {
    font-size: 0.8em;
    font-weight: 600;
    display: block;
    margin-top: 16px;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Main Panel Styling */
#main {
    flex-grow: 1;
    padding: 24px;
    height: 100vh;
    overflow-y: auto;
    box-sizing: border-box;
    background: var(--bg-main);
}

#main h3 {
    margin-top: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

#main label {
    font-size: 0.85em;
    font-weight: 600;
    display: block;
    margin-top: 10px;
    color: var(--primary-light);
}

#main input, #main select {
    width: 100%;
    padding: 10px 12px;
    margin-top: 6px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.9rem;
    background: white;
    color: var(--text-main);
    box-sizing: border-box;
    transition: all 0.2s ease;
}

#main input:focus, #main select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Language and Mode selectors */
.lang-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 15px;
}

.lang-btn {
    flex: 1;
    padding: 6px !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    border-radius: 6px !important;
    background: transparent !important;
    color: #94a3b8 !important;
    cursor: pointer;
    font-size: 11px !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
}

.lang-btn.active {
    background: rgba(255,255,255,0.15) !important;
    color: white !important;
    border-color: white !important;
}

/* Mode Selector Combo Box Styling */
.mode-select-container {
    margin-bottom: 20px;
}

.mode-select-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.mode-select-dropdown {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.25s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
}

.mode-select-dropdown:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
}

.mode-select-dropdown option {
    background: var(--primary);
    color: white;
    font-weight: 600;
}


/* Cards */
.card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

/* Tooltips */
.help-i {
    background: var(--primary-light);
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: help;
    margin-left: 6px;
    position: relative;
    vertical-align: middle;
    font-weight: bold;
}

.help-i:hover::after {
    content: attr(data-tip);
    position: absolute;
    background: #0f172a;
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    width: max-content;
    max-width: 260px;
    z-index: 9999;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255,255,255,0.1);
    bottom: 135%;
    left: 50%;
    transform: translateX(-50%);
    white-space: normal;
}

/* KPIs */
.kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

.kpi-box {
    background: rgba(255, 255, 255, 0.04);
    padding: 12px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
}

.kpi-box:hover {
    background: rgba(255, 255, 255, 0.08);
}

.kpi-box small {
    font-size: 0.7em;
    text-transform: uppercase;
    color: #94a3b8;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

.kpi-box div {
    font-size: 1.25em;
    font-weight: 700;
    margin-top: 6px;
}

/* Saturation Bar */
.sat-bg {
    background: #0f172a;
    border-radius: 20px;
    height: 30px;
    overflow: hidden;
    position: relative;
    margin: 20px 0;
    border: 1px solid rgba(255,255,255,0.1);
}

#saturationBar {
    height: 100%;
    width: 0%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--success);
}

#saturationLabel {
    position: absolute;
    width: 100%;
    text-align: center;
    line-height: 30px;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Tables */
#taskTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

#taskTable th {
    background: var(--bg-main);
    color: var(--primary-light);
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    text-align: left;
    padding: 12px 10px;
}

#taskTable td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

#taskTable tbody tr {
    cursor: pointer;
    transition: background 0.15s ease;
}

#taskTable tbody tr:hover {
    background: #f1f5f9;
}

/* Action button inside form */
.btn-action-primary {
    background: var(--accent);
    color: white;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-action-primary:hover {
    background: #2563eb;
}

.btn-action-secondary {
    background: var(--border);
    color: var(--primary-light);
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-action-secondary:hover {
    background: #cbd5e1;
}

/* Modal Styling */
#modalOverlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    z-index: 9000;
    justify-content: center;
    align-items: center;
    transition: all 0.3s;
}

#modalContent {
    background: white;
    width: 90%;
    max-width: 900px;
    padding: 36px;
    border-radius: 16px;
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
    color: var(--text-main);
    line-height: 1.6;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.help-section {
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
}

.help-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.help-section h2 {
    color: var(--primary);
    margin-top: 0;
    font-size: 1.35rem;
    font-weight: 700;
    border-left: 4px solid var(--accent);
    padding-left: 12px;
}

.help-section h3 {
    color: var(--accent);
    font-size: 1.05rem;
    margin-top: 16px;
    font-weight: 600;
}

.help-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.85rem;
}

.help-table th {
    background: var(--bg-main);
    padding: 10px;
    border: 1px solid var(--border);
    text-align: left;
    font-weight: 600;
}

.help-table td {
    padding: 10px;
    border: 1px solid var(--border);
}

/* Hidden elements helper */
.hidden {
    display: none !important;
}

/* PDF Wrapper offscreen generator */
#pdfWrapper {
    display: flex;
    width: 1200px;
    background: white;
    padding: 24px;
    box-sizing: border-box;
    position: absolute;
    left: -9999px;
    top: 0;
    color: #0f172a;
}

.pdf-side {
    width: 350px;
    background: #1e293b;
    color: white;
    padding: 24px;
    border-radius: 12px;
}

.pdf-main {
    flex-grow: 1;
    padding-left: 24px;
}

.pdf-card {
    border: 1px solid var(--border);
    padding: 18px;
    border-radius: 12px;
    margin-bottom: 18px;
}

/* General button */
.btn-m {
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
    body {
        flex-direction: column;
        height: auto;
        overflow: auto;
    }
    #sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 4px solid var(--accent);
        padding-bottom: 24px;
    }
    #main {
        width: 100%;
        height: auto;
        overflow: visible;
    }
}

@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    #main > div {
        grid-template-columns: 1fr !important;
    }
    .card div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    .btn-action-primary, .btn-action-secondary {
        margin-top: 10px;
    }
}

/* Task Entry Grid layout (2 columns: left for details, right for stopwatch) */
.task-entry-grid {
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 20px;
    align-items: stretch;
}

/* Partial Chips list and item styles */
.partial-chip {
    display: inline-flex;
    align-items: center;
    background: #e2e8f0; /* slate 200 */
    color: #1e293b; /* slate 800 */
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    animation: popIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.partial-chip span {
    margin-left: 6px;
    color: #ef4444; /* danger red */
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    display: inline-block;
    transition: transform 0.15s ease;
}

.partial-chip span:hover {
    transform: scale(1.25);
}

@keyframes popIn {
    0% { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Responsive adjust for task entry grid */
@media (max-width: 768px) {
    .task-entry-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Premium Digital Stopwatch Pane */
.stopwatch-instrument-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 24px;
    color: #f1f5f9;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.05);
    position: relative;
    overflow: hidden;
}

.stopwatch-instrument-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #38bdf8, #06b6d4, #10b981);
}

.instrument-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: 0.15em;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.digital-screen-outer {
    background: #020617;
    border: 2px solid #334155;
    border-radius: 12px;
    padding: 16px 28px;
    box-shadow: inset 0 4px 12px rgba(0,0,0,0.9), 0 0 15px rgba(56, 189, 248, 0.1);
    margin-bottom: 20px;
    width: 100%;
    position: relative;
    overflow: hidden;
    text-align: center;
}

.digital-screen-glare {
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.03) 50%, rgba(255,255,255,0) 100%);
    pointer-events: none;
    transform: rotate(-30deg);
}

.digital-time-display {
    font-family: 'Courier New', Courier, monospace;
    font-size: 3rem;
    font-weight: 700;
    color: #06b6d4;
    text-shadow: 0 0 12px rgba(6, 182, 212, 0.75), 0 0 25px rgba(6, 182, 212, 0.35);
    letter-spacing: 3px;
    user-select: none;
    line-height: 1.1;
}

.instrument-controls {
    display: flex;
    gap: 10px;
    width: 100%;
}

.btn-instrument {
    border: none;
    font-weight: 700;
    color: white;
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-start-pause {
    flex: 1;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-bottom: 2px solid #047857;
}

.btn-start-pause:hover:not(:disabled) {
    background: linear-gradient(135deg, #34d399 0%, #059669 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(16, 185, 129, 0.2);
}

.btn-record {
    flex: 1;
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    border-bottom: 2px solid #0369a1;
}

.btn-record:hover:not(:disabled) {
    background: linear-gradient(135deg, #7dd3fc 0%, #0284c7 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(56, 189, 248, 0.2);
}

.btn-clear {
    flex: 1;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-bottom: 2px solid #b91c1c;
}

.btn-clear:hover:not(:disabled) {
    background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(239, 68, 68, 0.2);
}

.btn-instrument:active {
    transform: translateY(1px);
    border-bottom-width: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.btn-instrument:disabled {
    background: #475569 !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    opacity: 0.6;
}

/* Tooltip styles for buttons */
.btn-tooltip {
    position: relative;
}

.btn-tooltip::after {
    content: attr(data-tip);
    position: absolute;
    background: #0f172a;
    color: #f8fafc;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.3;
    width: 200px;
    text-align: center;
    z-index: 2000;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255,255,255,0.1);
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    pointer-events: none;
    white-space: normal;
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-tooltip:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}