/**
 * HRD Management System - Custom Styles
 * PT Opelon Garment Indonesia
 */

/* ========================================
   CSS Variables
   ======================================== */
:root {
    --primary-color: #C0242B;
    --primary-dark: #A01E24;
    --primary-light: #E74C3C;
    --secondary-color: #2C3E50;
    --success-color: #27AE60;
    --warning-color: #F39C12;
    --danger-color: #E74C3C;
    --info-color: #3498DB;
    --light-bg: #F8F9FA;
    --sidebar-bg: #1a1a2e;
    --sidebar-width: 260px;
    --header-height: 60px;
    --text-muted: #6C757D;
    --border-color: #E9ECEF;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    --transition-speed: 0.3s;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: var(--secondary-color);
    background-color: var(--light-bg);
    overflow-x: hidden;
}

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

a:hover {
    color: var(--primary-dark);
}

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

/* ========================================
   Sidebar
   ======================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition-speed);
}

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

.company-logo {
    width: 45px;
    height: 45px;
    background: var(--primary-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 15px;
}

.company-info h5 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.company-info p {
    font-size: 11px;
    opacity: 0.7;
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 15px 0;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav .nav-item {
    margin: 2px 10px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    transition: all var(--transition-speed);
}

.sidebar-nav .nav-link i {
    font-size: 18px;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-nav .nav-link.active {
    background: var(--primary-color);
    color: white;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.version-info {
    font-size: 11px;
    opacity: 0.5;
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 25px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.btn-toggle-sidebar {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 5px;
    margin-right: 15px;
}

.header-title h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: var(--secondary-color);
}

.header-actions {
    margin-left: auto;
}

/* Page Content */
.page-content {
    flex: 1;
    padding: 25px;
}

/* ========================================
   Dashboard Stats
   ======================================== */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

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

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-right: 20px;
}

.stat-icon i {
    color: white;
}

.stat-card.stat-primary .stat-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
}

.stat-card.stat-success .stat-icon {
    background: linear-gradient(135deg, var(--success-color), #2ECC71);
}

.stat-card.stat-warning .stat-icon {
    background: linear-gradient(135deg, var(--warning-color), #F1C40F);
}

.stat-card.stat-danger .stat-icon {
    background: linear-gradient(135deg, var(--danger-color), #FF6B6B);
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    color: var(--secondary-color);
}

.stat-info p {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
}

/* ========================================
   Cards
   ======================================== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-speed);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    border-bottom: 1px solid var(--border-color);
    padding: 15px 20px;
    background: white;
    border-radius: 12px 12px 0 0 !important;
}

.card-header h5 {
    font-weight: 600;
    color: var(--secondary-color);
}

.card-body {
    padding: 20px;
}

/* ========================================
   Upload Area
   ======================================== */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 50px;
    text-align: center;
    background: var(--light-bg);
    transition: all var(--transition-speed);
    cursor: pointer;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(192, 36, 43, 0.05);
}

.upload-icon {
    font-size: 64px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.upload-area h4 {
    margin-bottom: 10px;
    color: var(--secondary-color);
}

/* ========================================
   Tables
   ======================================== */
.table {
    font-size: 13px;
}

.table thead th {
    font-weight: 600;
    color: var(--secondary-color);
    border-bottom: 2px solid var(--border-color);
    padding: 12px 15px;
    background: var(--light-bg);
}

.table tbody td {
    padding: 12px 15px;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(192, 36, 43, 0.03);
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all var(--transition-speed);
}

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

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

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

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

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

.btn-outline-success {
    color: var(--success-color);
    border-color: var(--success-color);
}

.btn-outline-success:hover {
    background: var(--success-color);
    border-color: var(--success-color);
}

/* ========================================
   Forms
   ======================================== */
.form-control,
.form-select {
    border-radius: 8px;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(192, 36, 43, 0.15);
}

.form-label {
    font-weight: 500;
    color: var(--secondary-color);
    margin-bottom: 8px;
}

/* ========================================
   Badges
   ======================================== */
.badge {
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 6px;
}

/* ========================================
   Progress Bars
   ======================================== */
.progress {
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

/* ========================================
   Toast Notifications
   ======================================== */
.toast {
    border-radius: 10px;
    border: none;
    box-shadow: var(--shadow-lg);
}

.toast-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 15px;
}

.toast-success {
    background: white;
}

.toast-error {
    background: white;
}

.toast-warning {
    background: white;
}

/* ========================================
   Loading Overlay
   ======================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-container {
    text-align: center;
}

.spinner-container p {
    margin-top: 15px;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f3f7fb 0%, #e8edf2 45%, #dfe6ee 100%);
    padding: 28px;
}

.login-card {
    width: 100%;
    max-width: 480px;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.14);
    background: rgba(255, 255, 255, 0.98);
}

.login-card .card-header {
    border-bottom: none;
    padding: 36px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
}

.login-card .card-header h3,
.login-card .card-header p {
    color: white;
}

.login-card .brand-badge {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 18px auto;
}

.login-card .card-body {
    padding: 32px;
}

.login-card .form-control {
    border-radius: 14px;
    padding: 14px 16px;
}

.login-card .btn-primary {
    border-radius: 14px;
    padding: 12px 18px;
}

.login-card .login-footer {
    font-size: 13px;
    color: #7d7d7d;
}

.login-card .login-footer a {
    color: var(--primary-color);
}

/* ========================================
   Modals
   ======================================== */
.modal-content {
    border: none;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 15px 20px;
}

.modal-title {
    font-weight: 600;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 15px 20px;
}

/* ========================================
   Quick Actions
   ======================================== */
.quick-actions {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

/* ========================================
   Summary Cards
   ======================================== */
.summary-card {
    background: var(--light-bg);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.summary-card small {
    display: block;
    margin-bottom: 5px;
}

.summary-card h4 {
    margin: 0;
    font-weight: 700;
    color: var(--secondary-color);
}

/* ========================================
   Module Tabs & Badges
   ======================================== */
.nav-tabs {
    border-bottom: 1px solid #d8dee8;
}

.nav-tabs .nav-link {
    border-radius: 10px 10px 0 0;
    border: 1px solid transparent;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.nav-tabs .module-tab-slip.active {
    color: #b42318;
    background: #fff2f0;
    border-color: #f4c7c3 #f4c7c3 #fff2f0;
}

.nav-tabs .module-tab-kompensasi.active {
    color: #946200;
    background: #fff8e1;
    border-color: #f3df9f #f3df9f #fff8e1;
}

.module-badge-board {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.module-badge-card {
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
    box-shadow: var(--shadow-sm);
}

.module-badge-card h5 {
    font-weight: 700;
}

.module-badge-slip {
    background: linear-gradient(135deg, #fff7f7 0%, #fff1f1 100%);
    border-color: #f7c5c5;
}

.module-badge-kompensasi {
    background: linear-gradient(135deg, #fffdf4 0%, #fff7dd 100%);
    border-color: #f0dc9a;
}

/* ========================================
   Upload Item
   ======================================== */
.upload-item {
    background: var(--light-bg);
    transition: all var(--transition-speed);
}

.upload-item:hover {
    background: white;
    box-shadow: var(--shadow-sm);
}

.upload-icon {
    color: var(--success-color);
}

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

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .btn-toggle-sidebar {
        display: block;
    }

    .stat-card {
        margin-bottom: 15px;
    }
}

@media (max-width: 768px) {
    .page-content {
        padding: 15px;
    }

    .top-header {
        padding: 0 15px;
    }

    .card-body {
        padding: 15px;
    }

    .table-responsive {
        font-size: 12px;
    }

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

    .module-badge-board {
        grid-template-columns: 1fr;
    }
}

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

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .sidebar,
    .top-header,
    .btn,
    .toast {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .page-content {
        padding: 0;
    }
}