/* CSS Variables for Dynamic White-Labeling */
:root {
    --primary-color: #0f172a;
    --primary-glow: rgba(15, 23, 42, 0.15);
    --secondary-color: #3b82f6;
    --accent-color: #10b981;
    --danger-color: #ef4444;
    --bg-main: #0b0f19;
    --bg-card: rgba(17, 24, 39, 0.75);
    --bg-sidebar: #0f172a;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-muted: #9ca3af;
    --transition-speed: 0.3s;
    --font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Light Theme Variables */
body.light-theme {
    --bg-main: #f3f4f6;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-sidebar: #ffffff;
    --border-color: rgba(0, 0, 0, 0.08);
    --text-primary: #111827;
    --text-muted: #6b7280;
    --primary-glow: rgba(59, 130, 246, 0.1);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* Main Container Grid */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: all var(--transition-speed);
}

.brand-section {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.brand-logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #ffffff;
    font-size: 1.35rem;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.25);
}

.brand-info h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}

.brand-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-grow: 1;
    overflow-y: auto;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-item a:hover {
    background-color: var(--primary-glow);
    color: var(--secondary-color);
}

.nav-item.active a {
    background-color: var(--secondary-color);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.user-profile-section {
    margin-top: auto;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 38px;
    height: 38px;
    background-color: var(--primary-glow);
    color: var(--secondary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 1px solid var(--secondary-color);
}

.user-details h4 {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.user-details span {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Main Workspace Pane */
.main-content {
    margin-left: 260px;
    flex-grow: 1;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    transition: margin-left var(--transition-speed);
}

/* Header Sections */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.content-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Premium Card Panels */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.5rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, box-shadow 0.2s;
}

.glass-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

/* Metric Stats Rows */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
}

.metric-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--card-accent, var(--secondary-color));
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.metric-value {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.metric-trend {
    font-size: 0.72rem;
}
.metric-trend.up { color: var(--accent-color); }
.metric-trend.down { color: var(--danger-color); }

/* Dashboard Grids Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.chart-container {
    height: 280px;
    position: relative;
}

/* Standard Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--secondary-color);
    color: #ffffff;
    box-shadow: 0 4px 10px var(--primary-glow);
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

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

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

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

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

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
    border-radius: 4px;
}

/* Form Elements */
.form-control {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
    font-size: 0.88rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.form-group {
    margin-bottom: 1.15rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

/* Kanban Board Elements */
.kanban-board {
    display: flex;
    gap: 1.15rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    align-items: flex-start;
}

.kanban-column {
    min-width: 290px;
    width: 290px;
    background-color: rgba(0, 0, 0, 0.18);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 170px);
}

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

.kanban-title {
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.kanban-count {
    background-color: rgba(255, 255, 255, 0.08);
    padding: 0.15rem 0.45rem;
    border-radius: 10px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.kanban-cards {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    flex-grow: 1;
    min-height: 120px;
}

.kanban-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.85rem;
    cursor: grab;
    transition: all 0.2s;
}

.kanban-card:hover {
    border-color: var(--secondary-color);
    transform: translateY(-1px);
}

.kanban-card.dragging {
    opacity: 0.4;
    cursor: grabbing;
}

.task-title {
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 0.25rem;
}

.task-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.task-tags {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.tag {
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.05);
}

.tag-priority-high { color: var(--danger-color); background-color: rgba(239, 68, 68, 0.08); }
.tag-priority-medium { color: var(--accent-color); background-color: rgba(16, 185, 129, 0.08); }
.tag-estimated { color: var(--secondary-color); background-color: rgba(59, 130, 246, 0.08); }

/* Table Data Elements */
.erp-table-container {
    overflow-x: auto;
    width: 100%;
}

.erp-table {
    width: 100%;
    border-collapse: collapse;
}

.erp-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.1);
}

.erp-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.erp-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.01);
}

/* Badge Status Chips */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-success { background-color: rgba(16, 185, 129, 0.08); color: var(--accent-color); }
.badge-warning { background-color: rgba(245, 158, 11, 0.08); color: #f59e0b; }
.badge-danger { background-color: rgba(239, 68, 68, 0.08); color: var(--danger-color); }
.badge-secondary { background-color: rgba(156, 163, 175, 0.08); color: var(--text-muted); }

/* Modals Overlay & Content */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 580px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.25s ease-out;
}

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

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-close {
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.35rem;
}

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.15rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Floating Timer Notification Widget */
.floating-timer-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border-radius: 12px;
    padding: 0.85rem 1.25rem;
    display: none;
    align-items: center;
    gap: 1rem;
    z-index: 999;
    animation: slideUp 0.3s ease-out;
}

.floating-timer-details h5 {
    font-size: 0.8rem;
    font-weight: 600;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.floating-timer-details span {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.floating-timer-clock {
    font-family: monospace;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-color);
}

.status-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--accent-color);
    animation: pulse 1.5s infinite;
}

/* Micro Animations */
@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.6; }
}

@keyframes slideUp {
    from { transform: translateY(15px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.views-container > .view-section {
    display: none;
}

.views-container > .view-section.active {
    display: block;
}

/* CRM and Two Column Custom layouts */
@media (min-width: 1200px) {
    .crm-grid {
        display: grid;
        grid-template-columns: 1.1fr 0.9fr;
        gap: 1.5rem;
    }
}

/* Printable / Screen Document layout styles */
.print-document {
    background: #ffffff;
    color: #1e293b;
    padding: 2.5rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    max-width: 800px;
    margin: 0 auto;
    font-family: var(--font-family);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.print-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.print-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.print-brand-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #3b82f6, #10b981);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
}

.print-brand h3 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
}

.print-doc-title {
    text-align: right;
}

.print-doc-title h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1e3a8a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.print-doc-title span {
    font-size: 0.8rem;
    color: #64748b;
}

.print-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.print-meta-col h4 {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.print-meta-col p {
    font-size: 0.9rem;
    color: #0f172a;
    line-height: 1.5;
}

.print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
}

.print-table th {
    background-color: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    color: #475569;
    padding: 0.75rem 1rem;
    font-weight: 600;
    text-align: left;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.print-table td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.85rem;
    color: #334155;
    vertical-align: middle;
}

.print-totals {
    margin-left: auto;
    width: 45%;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    font-size: 0.85rem;
    border-top: 2px solid #e2e8f0;
    padding-top: 1rem;
    margin-bottom: 2rem;
}

.print-total-row {
    display: flex;
    justify-content: space-between;
    color: #475569;
}

.print-total-row.grand {
    font-size: 1.1rem;
    font-weight: 800;
    color: #1e3a8a;
    border-top: 1px solid #e2e8f0;
    padding-top: 0.65rem;
}

.print-notes {
    font-size: 0.75rem;
    color: #64748b;
    border-top: 1px solid #f1f5f9;
    padding-top: 1rem;
    line-height: 1.4;
}

/* Printing Specific styles */
#print-section {
    display: none;
}

@media print {
    /* Hide screen elements */
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    .views-container, 
    .sidebar, 
    .floating-timer-container, 
    .modal-overlay,
    .btn,
    header,
    main,
    aside {
        display: none !important;
    }
    /* Show print section only */
    #print-section {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 100% !important;
        height: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        background: white !important;
        color: black !important;
    }
    
    .print-document {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }
}
