/* ========================================
   E-Bidding Helper - Stylesheet
   ======================================== */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --info: #0891b2;
    --dark: #1e293b;
    --gray: #64748b;
    --light: #f1f5f9;
    --white: #ffffff;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --topbar-height: 60px;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius: 10px;
    --radius-sm: 6px;
}

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

body {
    font-family: 'Sarabun', sans-serif;
    background: var(--light);
    color: var(--dark);
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: var(--white);
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .sidebar-menu span,
.sidebar.collapsed .sidebar-footer {
    display: none;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 700;
}

.sidebar-header .logo i {
    font-size: 1.5rem;
    color: #60a5fa;
}

.sidebar-menu {
    list-style: none;
    padding: 15px 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-menu li {
    margin: 2px 8px;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.sidebar-menu li a i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-menu li:hover a,
.sidebar-menu li.active a {
    color: var(--white);
    background: rgba(255,255,255,0.1);
}

.sidebar-menu li.active a {
    background: var(--primary);
    color: var(--white);
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    color: #64748b;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: all 0.3s ease;
}

.main-content.expanded {
    margin-left: var(--sidebar-collapsed);
}

/* Top Navbar */
.top-navbar {
    height: var(--topbar-height);
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.sidebar-toggle {
    color: var(--gray);
    font-size: 1.2rem;
    border: none;
    padding: 5px 10px;
}

.page-title {
    color: var(--dark);
    font-weight: 600;
}

/* Content Wrapper */
.content-wrapper {
    padding: 24px;
}

/* Page Content */
.page-content {
    display: none;
}

.page-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Stat Cards */
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid transparent;
    transition: all 0.2s ease;
}

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

.stat-primary { border-left-color: var(--primary); }
.stat-success { border-left-color: var(--success); }
.stat-warning { border-left-color: var(--warning); }
.stat-info { border-left-color: var(--info); }

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-primary .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-success .stat-icon { background: #dcfce7; color: var(--success); }
.stat-warning .stat-icon { background: #fef3c7; color: var(--warning); }
.stat-info .stat-icon { background: #cffafe; color: var(--info); }

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.stat-info p {
    color: var(--gray);
    font-size: 0.85rem;
    margin: 0;
}

/* Cards */
.card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.card-footer {
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
    padding: 16px 20px;
}

/* Guide List */
.guide-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.guide-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.guide-item:hover {
    background: var(--primary-light);
}

.guide-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.guide-item div {
    display: flex;
    flex-direction: column;
}

.guide-item strong {
    font-size: 0.9rem;
}

.guide-item small {
    color: var(--gray);
    font-size: 0.8rem;
}

/* Tables */
.table {
    margin: 0;
}

.table thead th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    font-size: 0.9rem;
}

.table-hover tbody tr:hover {
    background: #f8fafc;
}

/* Comparison Table */
.comparison-table thead th {
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.comparison-table .vendor-col {
    min-width: 150px;
}

.comparison-table .score-cell {
    text-align: center;
    font-weight: 600;
}

.comparison-table .score-pass {
    background: #dcfce7;
    color: #166534;
}

.comparison-table .score-fail {
    background: #fef2f2;
    color: #991b1b;
}

.comparison-table .score-partial {
    background: #fef3c7;
    color: #92400e;
}

/* Badges */
.badge-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-draft { background: #f1f5f9; color: #475569; }
.badge-active { background: #dbeafe; color: #1d4ed8; }
.badge-completed { background: #dcfce7; color: #166534; }
.badge-cancelled { background: #fef2f2; color: #991b1b; }

/* Report Cards */
.report-card {
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.report-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

/* Document Checklist */
.doc-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.doc-completed {
    text-decoration: line-through;
    opacity: 0.6;
}

/* Forms */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Vendor Cards */
.vendor-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    position: relative;
}

.vendor-card .vendor-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.vendor-card .vendor-detail {
    color: var(--gray);
    font-size: 0.8rem;
}

.vendor-card .vendor-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
}

.vendor-card .vendor-actions {
    position: absolute;
    top: 8px;
    right: 8px;
}

/* TOR Analysis */
.analysis-section {
    margin-bottom: 20px;
}

.analysis-section h6 {
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--primary-light);
}

.analysis-item {
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: var(--radius-sm);
    background: #f8fafc;
    font-size: 0.9rem;
}

.analysis-item i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

.keyword-tag {
    display: inline-block;
    padding: 4px 12px;
    margin: 3px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: default;
}

.keyword-tag.keyword-requirement { background: #dbeafe; color: #1d4ed8; }
.keyword-tag.keyword-qualification { background: #fce7f3; color: #be185d; }
.keyword-tag.keyword-deadline { background: #fef3c7; color: #92400e; }
.keyword-tag.keyword-budget { background: #dcfce7; color: #166534; }
.keyword-tag.keyword-technical { background: #e0e7ff; color: #3730a3; }
.keyword-tag.keyword-general { background: #f1f5f9; color: #475569; }

/* Action Items */
.action-item {
    display: flex;
    align-items: start;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
    background: #f8fafc;
}

.action-item .action-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* Report Preview */
.report-preview {
    background: var(--white);
    padding: 40px;
    font-size: 0.9rem;
}

.report-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px double var(--dark);
}

.report-header h3 {
    font-weight: 700;
    margin-bottom: 5px;
}

.report-header p {
    color: var(--gray);
    margin: 0;
}

.report-section {
    margin-bottom: 25px;
}

.report-section h5 {
    color: var(--primary);
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--primary-light);
}

/* Toast */
.toast-custom {
    border: none;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }
    
    .sidebar .sidebar-header span,
    .sidebar .sidebar-menu span,
    .sidebar .sidebar-footer {
        display: none;
    }
    
    .main-content {
        margin-left: var(--sidebar-collapsed);
    }
    
    .content-wrapper {
        padding: 16px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-info h3 {
        font-size: 1.4rem;
    }
}

@media (max-width: 576px) {
    .sidebar {
        width: 0;
        overflow: hidden;
    }
    
    .sidebar.mobile-open {
        width: var(--sidebar-width);
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* Print Styles */
@media print {
    .sidebar, .top-navbar, .btn, .dropdown {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .content-wrapper {
        padding: 0 !important;
    }
    
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
}