/* =====================================================
   Workflow Management System - Unified Styles
   Based on Ynex Dashboard Template
   ===================================================== */

:root {
    /* Primary Colors */
    --primary-rgb: 132, 90, 223;
    --primary: rgb(var(--primary-rgb));
    --primary-light: rgba(var(--primary-rgb), 0.1);

    /* Status Colors */
    --success-rgb: 38, 191, 148;
    --success: rgb(var(--success-rgb));
    --success-light: rgba(var(--success-rgb), 0.1);

    --warning-rgb: 245, 184, 73;
    --warning: rgb(var(--warning-rgb));
    --warning-light: rgba(var(--warning-rgb), 0.1);

    --danger-rgb: 230, 83, 60;
    --danger: rgb(var(--danger-rgb));
    --danger-light: rgba(var(--danger-rgb), 0.1);

    --info-rgb: 73, 182, 245;
    --info: rgb(var(--info-rgb));
    --info-light: rgba(var(--info-rgb), 0.1);

    --secondary-rgb: 135, 138, 153;
    --secondary: rgb(var(--secondary-rgb));

    /* Neutral Colors */
    --dark: #1a1d21;
    --text-muted: #8c9097;
    --border-color: #e9edf4;
    --bg-light: #f5f6fa;
    --white: #ffffff;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

    /* Border Radius */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-light);
    color: var(--dark);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: var(--primary);
}

/* =====================================================
   Layout - Sidebar
   ===================================================== */
.app-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 260px;
    height: 100vh;
    background: var(--white);
    border-left: 1px solid var(--border-color);
    z-index: 1000;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.sidebar-logo i {
    margin-left: 8px;
}

/* Sidebar Menu */
.sidebar-menu {
    padding: 16px 12px;
}

.menu-category {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px 8px;
    margin-top: 8px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    color: #5c6270;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.menu-item:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.menu-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.menu-item i {
    font-size: 18px;
    width: 24px;
}

.menu-item .badge {
    margin-right: auto;
    font-size: 10px;
}

/* =====================================================
   Layout - Main Content
   ===================================================== */
.app-content {
    margin-right: 260px;
    min-height: 100vh;
    transition: all 0.3s ease;
}

/* Header */
.app-header {
    background: var(--white);
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: var(--bg-light);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.header-icon:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.header-icon .badge-dot {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--white);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--white);
    background: var(--primary);
}

.user-info {
    text-align: left;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

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

/* Page Content */
.page-content {
    padding: 24px;
}

/* Page Header */
.page-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

/* =====================================================
   Cards
   ===================================================== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

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

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i {
    color: var(--primary);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-light);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* =====================================================
   Stat Cards
   ===================================================== */
.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.success { background: var(--success-light); color: var(--success); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon.danger { background: var(--danger-light); color: var(--danger); }
.stat-icon.info { background: var(--info-light); color: var(--info); }

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-change {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* =====================================================
   Badges
   ===================================================== */
.badge {
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-secondary { background: rgba(var(--secondary-rgb), 0.1); color: var(--secondary); }

/* Status Badges */
.badge-pending { background: var(--warning-light); color: var(--warning); }
.badge-approved { background: var(--success-light); color: var(--success); }
.badge-rejected { background: var(--danger-light); color: var(--danger); }
.badge-modified { background: var(--primary-light); color: var(--primary); }
.badge-executed { background: var(--info-light); color: var(--info); }

/* =====================================================
   Buttons
   ===================================================== */
.btn {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 15px;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}
.btn-primary:hover {
    background: rgba(var(--primary-rgb), 0.9);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.4);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}
.btn-success:hover {
    background: rgba(var(--success-rgb), 0.9);
}

.btn-warning {
    background: var(--warning);
    color: var(--dark);
}

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

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

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

.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}
.btn-outline-primary:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-light {
    background: var(--bg-light);
    color: var(--dark);
}

/* =====================================================
   Forms
   ===================================================== */
.form-label {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    display: block;
}

.form-control,
.form-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--white);
    transition: all 0.2s;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-select {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* =====================================================
   Tables
   ===================================================== */
.table-responsive {
    border-radius: var(--radius);
    overflow: hidden;
}

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

.table th {
    background: var(--bg-light);
    font-size: 12px;
    font-weight: 600;
    color: #5c6270;
    padding: 12px 16px;
    text-align: right;
    border: none;
}

.table td {
    padding: 14px 16px;
    font-size: 13px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: var(--bg-light);
}

/* =====================================================
   Timeline
   ===================================================== */
.timeline {
    position: relative;
    padding-right: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    right: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
    padding-right: 30px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    right: 0;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid var(--white);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.timeline-item.success::before { background: var(--success); box-shadow: 0 0 0 2px var(--success-light); }
.timeline-item.warning::before { background: var(--warning); box-shadow: 0 0 0 2px var(--warning-light); }
.timeline-item.danger::before { background: var(--danger); box-shadow: 0 0 0 2px var(--danger-light); }

.timeline-title {
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 4px;
}

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

/* =====================================================
   Progress Bars
   ===================================================== */
.progress {
    height: 8px;
    background: var(--bg-light);
    border-radius: 4px;
    overflow: hidden;
}

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

.progress-bar.primary { background: var(--primary); }
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }
.progress-bar.info { background: var(--info); }

/* =====================================================
   Workflow Diagram
   ===================================================== */
.workflow-diagram {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    overflow-x: auto;
}

.workflow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
}

.step-icon {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 10px;
    background: var(--bg-light);
    border: 3px solid var(--border-color);
    transition: all 0.3s;
}

.step-icon.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.4);
}

.step-icon.completed {
    background: var(--success);
    border-color: var(--success);
    color: var(--white);
}

.step-label {
    font-size: 12px;
    text-align: center;
    color: var(--text-muted);
    line-height: 1.4;
}

.step-connector {
    flex: 1;
    height: 3px;
    background: var(--border-color);
    margin: 0 8px;
    position: relative;
    top: -22px;
}

.step-connector.completed {
    background: var(--success);
}

/* =====================================================
   Modal
   ===================================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.modal-title {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* =====================================================
   Toast Notifications
   ===================================================== */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
}

.toast {
    background: var(--success);
    color: var(--white);
    padding: 14px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastSlide 0.3s ease;
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast.error {
    background: var(--danger);
}

.toast.warning {
    background: var(--warning);
    color: var(--dark);
}

/* =====================================================
   Empty State
   ===================================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h5 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--dark);
}

.empty-state p {
    font-size: 13px;
}

/* =====================================================
   Chart Containers
   ===================================================== */
.chart-container {
    position: relative;
    height: 300px;
}

.chart-container-sm {
    height: 200px;
}

.chart-container-lg {
    height: 400px;
}

/* =====================================================
   Utilities
   ===================================================== */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--text-muted) !important; }

.bg-primary-light { background: var(--primary-light) !important; }
.bg-success-light { background: var(--success-light) !important; }
.bg-warning-light { background: var(--warning-light) !important; }
.bg-danger-light { background: var(--danger-light) !important; }
.bg-info-light { background: var(--info-light) !important; }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.fs-16 { font-size: 16px; }
.fs-18 { font-size: 18px; }
.fs-20 { font-size: 20px; }
.fs-24 { font-size: 24px; }

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 1200px) {
    .app-sidebar {
        transform: translateX(100%);
    }

    .app-sidebar.open {
        transform: translateX(0);
    }

    .app-content {
        margin-right: 0;
    }
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 22px;
    }
}
