/**
 * contract_management/public/css/contract_management.css
 * Phase 8 — Full Design System
 */

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

/* ── CSS Variables ──────────────────────────────────────────────────────────── */
:root {
    --cm-primary:       #1e6fdb;
    --cm-primary-dark:  #1458b0;
    --cm-success:       #28a745;
    --cm-warning:       #ffc107;
    --cm-danger:        #dc3545;
    --cm-info:          #17a2b8;
    --cm-orange:        #e67e22;
    --cm-text-muted:    #6c757d;
    --cm-border:        #dee2e6;
    --cm-bg-light:      #f8f9fa;
    --cm-shadow:        0 2px 8px rgba(0,0,0,0.08);
    --cm-radius:        6px;
    --cm-font:          'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Global Typography ──────────────────────────────────────────────────────── */
.frappe-app body,
.page-container {
    font-family: var(--cm-font) !important;
}

/* ── Status Badge Colours ───────────────────────────────────────────────────── */
/* Construction Contract */
.indicator-pill.draft,
[data-label="Draft"] .indicator { background: #adb5bd !important; }

.indicator-pill[data-value="Submitted for Review"],
[data-label="Submitted for Review"] .indicator { background: var(--cm-warning) !important; color: #333 !important; }

.indicator-pill[data-value="Approved"],
[data-label="Approved"] .indicator { background: var(--cm-success) !important; }

.indicator-pill[data-value="Active"],
[data-label="Active"] .indicator { background: #00b386 !important; }

.indicator-pill[data-value="Completed"],
[data-label="Completed"] .indicator { background: var(--cm-info) !important; }

.indicator-pill[data-value="Cancelled"],
.indicator-pill[data-value="Terminated"],
[data-label="Cancelled"] .indicator { background: var(--cm-danger) !important; }

.indicator-pill[data-value="Suspended"],
[data-label="Suspended"] .indicator { background: var(--cm-orange) !important; }

/* Equipment Status */
.indicator-pill[data-value="Available"] { background: #c3e6cb !important; color: #155724 !important; }
.indicator-pill[data-value="In Use"] { background: #bee5eb !important; color: #0c5460 !important; }
.indicator-pill[data-value="Under Maintenance"] { background: #ffeeba !important; color: #856404 !important; }
.indicator-pill[data-value="Retired"] { background: #f5c6cb !important; color: #721c24 !important; }

/* ── Form Section Heading ───────────────────────────────────────────────────── */
.form-section .section-head {
    font-family: var(--cm-font) !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    color: var(--cm-primary) !important;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--cm-primary) !important;
    padding-bottom: 6px !important;
    margin-bottom: 12px !important;
}

/* ── Read-only Field Highlight ──────────────────────────────────────────────── */
.form-control[readonly],
.frappe-control.read-only .form-control {
    background-color: #f0f4ff !important;
    color: var(--cm-primary-dark) !important;
    font-weight: 500 !important;
}

/* ── Dashboard Comment Banners ──────────────────────────────────────────────── */
.form-dashboard .comment-box {
    border-radius: var(--cm-radius) !important;
    font-family: var(--cm-font) !important;
    font-size: 13px !important;
    padding: 10px 14px !important;
    margin-bottom: 10px !important;
    box-shadow: var(--cm-shadow) !important;
    border-left: 4px solid currentColor !important;
}

/* ── List View Improvements ─────────────────────────────────────────────────── */
.list-row {
    transition: background 0.15s ease !important;
}
.list-row:hover {
    background: #f0f4ff !important;
}

/* ── Currency Fields ────────────────────────────────────────────────────────── */
[data-fieldtype="Currency"] .form-control {
    font-weight: 600 !important;
    font-family: 'Inter', monospace !important;
    letter-spacing: 0.2px;
}

/* ── Mandatory Field Indicator ──────────────────────────────────────────────── */
.reqd .help-box::after,
.reqd .label-area::after {
    content: " *";
    color: var(--cm-danger);
    font-weight: 700;
}

/* ── Print Layout ───────────────────────────────────────────────────────────── */
@media print {
    .form-section .section-head {
        border-bottom: 1px solid #333 !important;
        color: #000 !important;
    }
    .form-dashboard { display: none !important; }
    body { font-family: 'Inter', Arial, sans-serif !important; }
}

/* ── Brand logo (v15 navbar + v16 desk sidebar / desktop) ─────────────────── */
.navbar-brand img.app-logo,
.navbar .navbar-brand img,
.sidebar-header img,
.desk-sidebar img.app-logo,
.desktop-icon img,
img.cm-brand-logo {
    max-height: 40px;
    width: auto;
    object-fit: contain;
}

.desktop-container .desktop-icon img {
    max-height: 56px;
}

.for-login .page-card-head img.app-logo,
.for-forgot .page-card-head img.app-logo,
.for-signup .page-card-head img.app-logo,
.for-email-login .page-card-head img.app-logo {
    max-height: 128px;
    max-width: 240px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.footer-powered,
.web-footer .footer-powered {
    display: none !important;
}

html[lang="ar"]:not([dir]),
html[lang="ar"][dir="rtl"] {
    direction: rtl;
}

/* ── v16 Espresso sidebar (RTL: Frappe mirrors it when html[dir=rtl]) ─────── */
[dir="rtl"] .form-section .section-head {
    border-bottom: none !important;
    border-top: 2px solid var(--cm-primary) !important;
    padding-top: 6px !important;
    padding-bottom: 0 !important;
}

[dir="rtl"] .desk-sidebar,
[dir="rtl"] .workspace-sidebar {
    text-align: right;
}

.workspace-sidebar .standard-sidebar-item.active,
.desk-sidebar .standard-sidebar-item.active {
    border-inline-start: 3px solid var(--cm-primary);
    background: color-mix(in srgb, var(--cm-primary) 12%, transparent);
    border-radius: var(--cm-radius);
}

/* Sidebar labels: wrap instead of truncating long English / mixed RTL text */
.workspace-sidebar .standard-sidebar-item .item-anchor,
.workspace-sidebar .sidebar-item-control .item-anchor,
.desk-sidebar .standard-sidebar-item .item-anchor,
.desk-sidebar .sidebar-item-control .item-anchor {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    line-height: 1.4;
    min-height: 2.25rem;
    padding-block: 6px;
    hyphens: auto;
}

.workspace-sidebar .standard-sidebar-item,
.desk-sidebar .standard-sidebar-item {
    margin-block: 2px;
}

.workspace-sidebar .standard-sidebar-item[data-item-type="Section Break"] .item-anchor,
.desk-sidebar .standard-sidebar-item[data-item-type="Section Break"] .item-anchor {
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.02em;
    opacity: 0.92;
    margin-top: 6px;
    min-height: 1.75rem;
}

.workspace-sidebar .sidebar-item-icon,
.desk-sidebar .sidebar-item-icon {
    flex-shrink: 0;
    margin-inline-end: 8px;
}

[dir="rtl"] .workspace-sidebar .sidebar-item-container,
[dir="rtl"] .desk-sidebar .sidebar-item-container {
    padding-inline: 8px 10px;
}
