/* File: assets/style.css */

/* Global Styles */
:root {
    --primary-color: #4e73df;
    --secondary-color: #1cc88a;
    --danger-color: #e74a3b;
    --warning-color: #f6c23e;
    --info-color: #36b9cc;
    --dark-color: #5a5c69;
    --light-color: #f8f9fc;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fc;
    color: #5a5c69;
}

.badge {
    padding: 0.35em 0.65em;
    font-weight: 700;
    border-radius: 0.25rem;
    color: white;
    display: inline-block;
}

.bg-primary {
    background-color: var(--primary-color);
}

.bg-success {
    background-color: var(--secondary-color);
}

.bg-danger {
    background-color: var(--danger-color);
}

.bg-warning {
    background-color: var(--warning-color);
}

.bg-info {
    background-color: var(--info-color);
}

/* Header & Logo */
.header {
    text-align: center;
    padding: 15px 0;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px; /* Tambahkan jarak antara logo dan judul */
}

.logo {
    max-width: 100px; /* Kurangi ukuran logo */
    height: auto;
    margin: 0; /* Hapus semua margin */
}

.app-title {
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    font-size: 1.5rem;
}

/* Login Page */
.login-container {
    max-width: 450px;
    margin: 50px auto;
    padding: 30px;
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Forms */
.form-container {
    background-color: white;
    padding: 25px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    font-size: 14px;
    border: 1px solid #d1d3e2;
    border-radius: 4px;
    box-sizing: border-box;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

.form-select {
    width: 100%;
    padding: 10px 15px;
    font-size: 14px;
    border: 1px solid #d1d3e2;
    border-radius: 4px;
    background-color: white;
    box-sizing: border-box;
}

.btn {
    display: inline-block;
    font-weight: 600;
    color: white;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #2e59d9;
}

.btn-success {
    background-color: var(--secondary-color);
}

.btn-success:hover {
    background-color: #17a673;
}

.btn-danger {
    background-color: var(--danger-color);
}

.btn-danger:hover {
    background-color: #be2617;
}

.btn-warning {
    background-color: var(--warning-color);
    color: #5a5c69;
}

.btn-warning:hover {
    background-color: #dda20a;
}

.btn-info {
    background-color: var(--info-color);
}

.btn-info:hover {
    background-color: #2c9faf;
}

.btn-secondary {
    background-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0.2rem;
}

/* Tables */
.table-container {
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    margin-bottom: 30px;
}

.table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e3e6f0;
    text-align: left;
}

.table th {
    background-color: #f8f9fc;
    font-weight: 700;
    color: #4e73df;
}

.table tr:hover {
    background-color: #f8f9fc;
}

/* Admin Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.dashboard-title {
    margin: 0;
    font-weight: 700;
    color: var(--dark-color);
}

.card-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    flex: 1;
    min-width: 250px;
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.card-primary {
    border-left: 4px solid var(--primary-color);
}

.card-success {
    border-left: 4px solid var(--secondary-color);
}

.card-warning {
    border-left: 4px solid var(--warning-color);
}

.card-info {
    border-left: 4px solid var(--info-color);
}

.card-title {
    text-transform: uppercase;
    color: var(--primary-color);
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0;
}

/* Admin Sidebar and Layout */
.admin-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: #4e73df;
    background-image: linear-gradient(180deg, #4e73df 10%, #224abe 100%);
    color: white;
    min-height: 100vh;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
}

.sidebar-header {
    padding: 25px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-brand {
    color: white;
    font-weight: 800;
    font-size: 1.2rem;
    text-decoration: none;
}

.sidebar-menu {
    padding: 0;
    list-style: none;
    margin-top: 20px;
}

.sidebar-item {
    margin-bottom: 5px;
}

.sidebar-link {
    display: block;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-icon {
    margin-right: 10px;
    width: 16px;
    text-align: center;
}

.content-wrapper {
    margin-left: 250px;
    width: calc(100% - 250px);
    padding: 30px;
}

.admin-footer {
    margin-top: 50px;
    padding: 20px 0;
    border-top: 1px solid #e3e6f0;
    text-align: center;
    color: #858796;
}

/* ATK Form Styles */
.atk-item {
    background-color: #f8f9fc;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 15px;
    position: relative;
}

.remove-item {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    color: var(--danger-color);
}

.add-item-btn {
    margin-bottom: 20px;
}

/* CSS untuk header dengan 2 logo */
.admin-header {
    text-align: center;
    padding: 15px;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.logo-left {
    max-width: 50px;
    height: auto;
}

.logo-right {
    max-width: 110px;
    height: auto;
}

.app-title {
    font-weight: 700;
    color: #4e73df;
    margin: 0;
    font-size: 1.4rem;
}

/* Print specific styles untuk halaman cetak */
.print-only {
    display: none;
}

@media print {
    .print-only {
        display: block;
    }
    
    .no-print {
        display: none !important;
    }
    
    body {
        font-size: 11px;
        line-height: 1.3;
    }
    
    /* Improved table printing */
    .items-table {
        page-break-inside: auto;
        border-collapse: collapse;
    }
    
    .items-table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
    
    .items-table thead {
        display: table-header-group;
    }
    
    .items-table tfoot {
        display: table-footer-group;
    }
    
    /* Ensure header repeats on each page */
    .items-table thead tr {
        break-inside: avoid;
    }
    
    /* If table is very long, ensure it starts on a new page */
    .items-section {
        page-break-before: auto;
    }
    
    /* Prevent widows and orphans */
    p, li {
        orphans: 3;
        widows: 3;
    }
    
    /* Keep signature section together */
    .signature-section {
        page-break-inside: avoid;
        margin-top: 30px;
    }
    
    /* Keep info boxes together */
    .info-box {
        page-break-inside: avoid;
    }
    
    /* Pastikan header muncul di setiap halaman */
    .print-header {
        position: running(header);
    }
    
    @page {
        @top-center {
            content: running(header);
        }
        size: A4;
        margin: 1cm 1.5cm;
    }
}

/* Responsive */
@media (max-width: 992px) {
    .admin-header {
        padding: 10px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 8px;
    }
    
    .logo-left, .logo-right {
        max-width: 40px;
    }
    
    .app-title {
        font-size: 1.2rem;
    }
}

/* Perbaikan untuk sidebar mobile */
@media (max-width: 768px) {
    .card-container {
        flex-direction: column;
    }
    
    .admin-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: relative;
        min-height: auto;
        display: none; /* Hidden by default on mobile */
    }
    
    .content-wrapper {
        margin-left: 0;
        width: 100%;
    }
    
    .sidebar-toggle {
        position: fixed;
        top: 15px;
        right: 15px;
        z-index: 999;
        display: block !important;
    }
    
    .show-mobile-sidebar {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 80%;
        height: 100vh;
        z-index: 998;
        overflow-y: auto;
    }
}

/* Fix untuk tampilan perangkat kecil */
@media (max-width: 576px) {
    .header {
        flex-direction: column;
        gap: 10px;
    }
    
    .logo {
        max-width: 80px;
    }
    
    .app-title {
        font-size: 1.2rem;
    }
    
    .admin-header .header-content {
        flex-direction: column;
        gap: 10px;
    }
    
    .admin-header .logo-left,
    .admin-header .logo-right {
        max-width: 35px;
    }
    
    .admin-header .app-title {
        font-size: 1rem;
    }
    
    /* Mobile table responsiveness */
    .table-container {
        overflow-x: auto;
    }
    
    .table {
        min-width: 600px;
    }
    
    /* Mobile button spacing */
    .btn-sm {
        margin: 2px;
        padding: 0.2rem 0.4rem;
        font-size: 0.8rem;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .content-wrapper {
        padding: 15px;
    }
    
    .form-container {
        padding: 15px;
    }
    
    .card {
        padding: 15px;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .dashboard-title {
        font-size: 1.5rem;
    }
}