/* ============================================
   Dashboard TDB PMI - Stylesheet
   Palang Merah Indonesia (PMI)
   ============================================ */

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --pmi-red: #DC143C;
    --pmi-red-dark: #B71C1C;
    --pmi-red-light: #FF6B6B;
    --white: #FFFFFF;
    --gray-light: #F5F5F5;
    --gray: #E0E0E0;
    --gray-dark: #757575;
    --text-dark: #212121;
    --text-light: #616161;
    --success: #4CAF50;
    --error: #F44336;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-dark);
    background-color: var(--gray-light);
    line-height: 1.6;
}

/* ============================================
   Login Page Styles
   ============================================ */

.login-page {
    background: linear-gradient(135deg, var(--pmi-red) 0%, var(--pmi-red-dark) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-box {
    background: var(--white);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.dislog-logo {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-img {
    max-width: 200px;
    height: auto;
    object-fit: contain;
}

/* Fallback untuk logo lama jika diperlukan */
.pmi-logo {
    margin-bottom: 20px;
}

.logo-circle {
    width: 80px;
    height: 80px;
    background: var(--pmi-red);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    margin: 0 auto;
    box-shadow: var(--shadow);
}

.login-header h1 {
    color: var(--pmi-red);
    font-size: 24px;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-light);
    font-size: 14px;
}

.login-form {
    margin-top: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--gray);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--pmi-red);
}

.error-message {
    color: var(--error);
    font-size: 14px;
    margin-bottom: 15px;
    padding: 10px;
    background: #FFEBEE;
    border-radius: 6px;
    display: none;
}

.error-message.show {
    display: block;
}

/* ============================================
   Button Styles
   ============================================ */

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--pmi-red);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--pmi-red-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--gray);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background: var(--gray-dark);
    color: var(--white);
}

.btn-block {
    width: 100%;
}

/* ============================================
   Dashboard Layout
   ============================================ */

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--white);
    box-shadow: var(--shadow);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-header {
    padding: 24px;
    background: var(--pmi-red);
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 12px;
}

.dislog-logo-small {
    display: flex;
    align-items: center;
}

.logo-img-small {
    max-width: 120px;
    height: auto;
    object-fit: contain;
    filter: brightness(0) invert(1); /* Membuat logo putih untuk kontras dengan background merah */
}

/* Fallback untuk logo lama jika diperlukan */
.pmi-logo-small {
    display: flex;
    align-items: center;
}

.logo-circle-small {
    width: 40px;
    height: 40px;
    background: var(--white);
    color: var(--pmi-red);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--gray-light);
    border-left-color: var(--pmi-red);
}

.nav-item.active {
    background: #FFEBEE;
    color: var(--pmi-red);
    border-left-color: var(--pmi-red);
    font-weight: 600;
}

.nav-icon {
    font-size: 18px;
}

.logout-btn {
    margin-top: 20px;
    border-top: 1px solid var(--gray);
    padding-top: 20px;
}

/* Main Content */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 0;
    background: var(--gray-light);
}

.top-bar {
    background: var(--white);
    padding: 20px 30px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar h1 {
    color: var(--pmi-red);
    font-size: 24px;
    font-weight: 600;
}

.user-info {
    color: var(--text-light);
    font-size: 14px;
}

/* Page Content */
.page-content {
    display: none;
    padding: 30px;
}

.page-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.page-header {
    margin-bottom: 24px;
}

.search-filter-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 12px;
    border: 2px solid var(--gray);
    border-radius: 6px;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: var(--pmi-red);
}

.filter-select {
    padding: 12px;
    border: 2px solid var(--gray);
    border-radius: 6px;
    font-size: 14px;
    background: var(--white);
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--pmi-red);
}

/* Table Styles */
.table-container {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--pmi-red);
    color: var(--white);
}

.data-table th {
    padding: 14px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--gray);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: var(--gray-light);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Form Container */
.form-container {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 30px;
    max-width: 900px;
}

.form-container h2 {
    color: var(--pmi-red);
    margin-bottom: 24px;
    font-size: 22px;
}

.data-form {
    margin-top: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--gray);
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h3 {
    color: var(--pmi-red);
    font-size: 18px;
    margin-bottom: 20px;
    font-weight: 600;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* Autocomplete Styles */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 2px solid var(--pmi-red);
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: var(--shadow-lg);
}

.autocomplete-list.show {
    display: block;
}

.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray);
    transition: background 0.2s;
}

.autocomplete-item:hover {
    background: var(--gray-light);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item strong {
    color: var(--pmi-red);
}

/* Nota Styles */
.nota-container {
    margin-top: 30px;
    padding: 30px;
    background: var(--gray-light);
    border-radius: 8px;
}

.nota-container.hidden {
    display: none;
}

.nota-content {
    background: var(--white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.nota-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--pmi-red);
}

.nota-header h3 {
    color: var(--pmi-red);
    font-size: 24px;
    margin-bottom: 8px;
}

.nota-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.nota-detail-item {
    display: flex;
    flex-direction: column;
}

.nota-detail-label {
    font-weight: 600;
    color: var(--text-light);
    font-size: 12px;
    margin-bottom: 4px;
}

.nota-detail-value {
    color: var(--text-dark);
    font-size: 14px;
}

.nota-table {
    width: 100%;
    margin-top: 20px;
    border-collapse: collapse;
}

.nota-table th,
.nota-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--gray);
}

.nota-table th {
    background: var(--gray-light);
    font-weight: 600;
}

.nota-signature {
    margin-top: 40px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
    padding-top: 30px;
}

.nota-signature-item {
    text-align: center;
}

.nota-signature-label {
    margin-bottom: 60px;
    font-weight: 600;
    color: var(--text-dark);
}

.nota-signature-line {
    border-top: 2px solid var(--text-dark);
    width: 200px;
    margin: 0 auto;
    padding-top: 5px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--white);
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid var(--gray);
}

.modal-header h2 {
    color: var(--pmi-red);
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--pmi-red);
}

.modal-content .data-form {
    padding: 30px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-edit {
    background: #2196F3;
    color: var(--white);
    padding: 6px 12px;
    font-size: 12px;
}

.btn-edit:hover {
    background: #1976D2;
}

.btn-delete {
    background: var(--error);
    color: var(--white);
    padding: 6px 12px;
    font-size: 12px;
}

.btn-delete:hover {
    background: #D32F2F;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 10px;
    }

    .nav-item {
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .nav-item.active {
        border-left: none;
        border-bottom-color: var(--pmi-red);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .search-filter-bar {
        flex-direction: column;
    }

    .nota-details {
        grid-template-columns: 1fr;
    }

    .table-container {
        overflow-x: auto;
    }
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }

    .nota-content,
    .nota-content * {
        visibility: visible;
    }

    .nota-content {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }

    .btn {
        display: none;
    }
    
    .nota-signature {
        margin-top: 60px;
        page-break-inside: avoid;
    }
    
    .nota-signature-item {
        margin-bottom: 20px;
    }
    
    .nota-signature-label {
        margin-bottom: 80px !important;
        font-size: 14px;
        font-weight: 600;
    }
    
    .nota-signature-line {
        border-top: 2px solid #000 !important;
        width: 250px !important;
        margin: 0 auto;
        padding-top: 5px;
        margin-bottom: 10px;
    }
    
    .nota-signature-name {
        font-size: 11px !important;
        color: #000;
        margin-top: 5px;
    }
}

