/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --bg-color: #f8fafc;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --card-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-box {
    background: white;
    padding: 50px 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.login-header {
    text-align: center;
    margin-bottom: 35px;
}

.login-logo {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-logo img {
    max-width: 180px;
    max-height: 80px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.login-box h1 {
    color: var(--primary-color);
    font-size: 32px;
    font-weight: 700;
    margin: 0;
    text-align: center;
    letter-spacing: -0.5px;
}

.login-form {
    margin-top: 30px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 14px;
}

.login-form .form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
}

.login-form .form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.login-form .btn-block {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 10px;
    border-radius: 8px;
    transition: all 0.3s;
}

.login-form .btn-block:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.login-footer {
    margin-top: 30px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.login-info-text {
    margin: 0;
    color: var(--text-light);
    font-size: 13px;
}

.login-info-text small {
    color: var(--text-light);
}

.login-info-text strong {
    color: var(--text-dark);
    font-weight: 600;
}

.login-box .alert-error {
    margin-bottom: 20px;
    padding: 12px 16px;
    background-color: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    color: var(--danger-color);
    font-size: 14px;
}

/* Error Page (404) */
.error-page-content {
    text-align: center;
    padding: 20px 0;
}

.error-code {
    font-size: 100px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 20px 0;
    line-height: 1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.error-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 15px 0;
}

.error-message {
    color: var(--text-light);
    font-size: 15px;
    margin: 0 0 30px 0;
    line-height: 1.6;
}

/* Layout */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 1000;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-header h2,
.sidebar.collapsed .sidebar-nav a span:not(.menu-tooltip) {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    padding: 20px 10px;
    text-align: center;
}

.sidebar.collapsed .sidebar-header img {
    margin: 0 auto;
    max-width: 50px;
    max-height: 30px;
}

.sidebar.collapsed .sidebar-header h2 {
    display: none;
}

.sidebar.collapsed .sidebar-nav a {
    padding: 12px;
    text-align: center;
    position: relative;
}

.sidebar.collapsed .sidebar-nav i {
    margin-right: 0;
    font-size: 20px;
}

.sidebar.collapsed .sidebar-nav a {
    position: relative;
}

.sidebar.collapsed .sidebar-nav a:hover .menu-tooltip {
    display: block;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 20px;
    color: white;
    margin-top: 10px;
}

.sidebar-header i {
    margin-right: 8px;
    color: var(--primary-color);
}

.sidebar-header img {
    max-width: 120px;
    max-height: 60px;
    object-fit: contain;
    display: block;
    margin: 0 auto 10px;
    border-radius: 4px;
}

.sidebar-nav ul {
    list-style: none;
    padding: 10px 0;
}

.sidebar-nav a {
    display: block;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: white;
}

.sidebar-nav a.active {
    background: var(--primary-color);
    color: white;
}

.sidebar-nav i {
    width: 20px;
    margin-right: 10px;
}

/* Tooltip for collapsed sidebar */
.menu-tooltip {
    display: none;
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-dark);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 1001;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.menu-tooltip::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: var(--text-dark);
}

.sidebar.collapsed .sidebar-nav li {
    position: relative;
}

/* Main Content */
.main-content {
    margin-left: 260px;
    flex: 1;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 70px;
}

/* Topbar */
.topbar {
    background: white;
    padding: 15px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sidebar-toggle {
    display: block;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-dark);
    padding: 5px 10px;
    transition: transform 0.3s ease;
}

.sidebar-toggle:hover {
    color: var(--primary-color);
}

.sidebar.collapsed ~ .main-content .sidebar-toggle i::before {
    content: "\f0c9"; /* fa-bars */
}

.topbar h1 {
    font-size: 24px;
    color: var(--text-dark);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* User Menu Dropdown */
.user-menu-wrapper {
    position: relative;
}

.user-profile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.user-profile-trigger:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.1);
}

.user-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
    flex-shrink: 0;
}

.user-photo-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
    border: 2px solid var(--primary-color);
}

.user-info-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.dropdown-arrow {
    font-size: 12px;
    color: var(--text-light);
    transition: transform 0.3s ease;
    margin-left: 4px;
}

.user-menu-wrapper.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    min-width: 240px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow: hidden;
}

.user-menu-wrapper.active .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.dropdown-user-photo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.dropdown-user-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dropdown-photo-placeholder {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.dropdown-user-info {
    flex: 1;
    min-width: 0;
}

.dropdown-user-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-user-email {
    font-size: 12px;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 14px;
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    color: var(--text-light);
    font-size: 16px;
}

.dropdown-item:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.dropdown-item:hover i {
    color: var(--primary-color);
}

.dropdown-item-danger {
    color: var(--danger-color);
}

.dropdown-item-danger i {
    color: var(--danger-color);
}

.dropdown-item-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

/* Close dropdown when clicking outside */
body.dropdown-open {
    overflow: hidden;
}

/* Modal Popup */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h3 {
    color: var(--primary-color);
    font-size: 22px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--bg-color);
    color: var(--text-dark);
}

.modal-body {
    margin-bottom: 20px;
    color: var(--text-dark);
    line-height: 1.8;
}

.modal-body p {
    margin-bottom: 15px;
}

.modal-body strong {
    color: var(--primary-color);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

/* Popup Modal for Sub Types (Simple, not fullscreen) */
.modal-fullscreen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Hide all background elements when modal is open */
body.modal-subtype-open .sidebar,
body.modal-subtype-open .topbar,
body.modal-subtype-open .main-content {
    display: none !important;
}

.modal-fullscreen.active {
    display: flex;
    opacity: 1;
}

.modal-fullscreen-box {
    background: white;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Close button for table-only modal */
.modal-table-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    font-size: 18px;
    color: white;
    cursor: pointer;
    padding: 8px 10px;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.3s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.modal-table-close:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.modal-fullscreen.active .modal-fullscreen-box {
    transform: scale(1);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 2px solid var(--border-color);
    background: white;
    flex-shrink: 0;
}

.modal-fullscreen-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

.modal-fullscreen-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    padding: 5px 10px;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.3s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-fullscreen-close:hover {
    background: var(--bg-color);
    color: var(--text-dark);
}

.modal-fullscreen-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

/* Attractive Sub Type Modal Styles */
.subtype-modal-container {
    max-width: 850px;
    width: 90%;
    padding: 0;
}

.subtype-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 25px 30px;
    border-bottom: 2px solid var(--border-color);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.05) 0%, rgba(79, 70, 229, 0.02) 100%);
    border-radius: 12px 12px 0 0;
}

.subtype-modal-header-left {
    flex: 1;
}

.subtype-modal-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.subtype-context-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-dark);
    margin-top: 8px;
}

.subtype-context-badge i {
    color: var(--primary-color);
}

.subtype-context-badge strong {
    color: var(--primary-color);
    font-weight: 600;
}

.subtype-modal-close {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    font-size: 20px;
    color: var(--text-light);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.subtype-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-dark);
}

.subtype-modal-body {
    padding: 0;
    overflow-y: auto;
    overflow-x: auto;
    flex: 1;
    max-height: 70vh;
}

.subtype-modal-content-wrapper {
    padding: 25px 30px;
    overflow: visible;
}

.subtype-action-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 15px;
}

.subtype-info-section {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.subtype-info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: var(--bg-color);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    min-width: 140px;
}

.subtype-info-item i {
    font-size: 24px;
    color: var(--primary-color);
    width: 32px;
    text-align: center;
}

.subtype-info-item > div {
    display: flex;
    flex-direction: column;
}

.subtype-info-label {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.subtype-info-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
}

.subtype-table-wrapper {
    background: white;
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: visible;
    border: 1px solid var(--border-color);
    position: relative;
}

.subtype-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    min-width: 600px;
}

.subtype-table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.subtype-table th {
    padding: 15px 18px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
}

.subtype-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.subtype-table tbody tr:hover {
    background: var(--bg-color);
}

.subtype-table tbody tr:last-child {
    border-bottom: none;
}

.subtype-table td {
    padding: 16px 18px;
    vertical-align: middle;
}

/* Kolom aksi sticky - selalu terlihat */
.subtype-table th:last-child,
.subtype-table td:last-child {
    position: sticky;
    right: 0;
    background: white;
    z-index: 10;
    min-width: 150px;
    white-space: nowrap;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.05);
    padding-left: 20px;
    padding-right: 20px;
}

.subtype-table tbody tr:hover td:last-child {
    background: var(--bg-color);
}

.subtype-table thead th:last-child {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
}

/* Text overflow untuk kolom nama */
.subtype-table td:first-child {
    max-width: 300px;
    overflow: hidden;
}

.subtype-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.subtype-name-cell strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

/* Text overflow untuk deskripsi */
.subtype-table td:nth-child(2) {
    max-width: 250px;
    overflow: hidden;
}

.subtype-description {
    color: var(--text-light);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.subtype-description {
    color: var(--text-light);
    font-size: 14px;
}

.subtype-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: flex-end;
    min-width: 140px;
}

.subtype-actions .btn {
    padding: 8px 14px;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: auto;
}

.subtype-empty-state {
    padding: 60px 30px !important;
    text-align: center;
}

.empty-state-content {
    max-width: 400px;
    margin: 0 auto;
}

.empty-state-content i {
    font-size: 64px;
    color: var(--text-light);
    opacity: 0.3;
    margin-bottom: 20px;
    display: block;
}

.empty-state-content h3 {
    font-size: 20px;
    color: var(--text-dark);
    margin: 0 0 10px 0;
    font-weight: 600;
}

.empty-state-content p {
    color: var(--text-light);
    margin: 0 0 25px 0;
    font-size: 14px;
}

.loading-state,
.error-state {
    text-align: center;
    padding: 60px 30px;
    color: var(--text-light);
}

.loading-state i,
.error-state i {
    font-size: 32px;
    margin-bottom: 15px;
    display: block;
    color: var(--primary-color);
}

.error-state i {
    color: var(--danger-color);
}

.subtype-context {
    font-size: 15px;
    color: var(--text-dark);
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--bg-color);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.subtype-context strong {
    color: var(--primary-color);
    font-weight: 600;
}

.subtype-form-container {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    display: none;
}

.subtype-form-container.active {
    display: block;
}

.subtype-form-container .form-group {
    margin-bottom: 15px;
}

.subtype-form-container .form-group:last-child {
    margin-bottom: 0;
}

.subtype-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Simple Modal for Add/Edit Sub Type Form */
.modal-simple-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-simple-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-simple-box {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-simple-overlay.active .modal-simple-box {
    transform: scale(1);
}

.modal-simple-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid var(--border-color);
}

.modal-simple-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

.modal-simple-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
    padding: 5px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.3s;
}

.modal-simple-close:hover {
    background: var(--bg-color);
    color: var(--text-dark);
}

.modal-simple-body {
    padding: 25px;
}

.modal-footer .btn {
    min-width: 100px;
}

/* Content Area */
.content-area {
    padding: 30px;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.3s;
}

.card:hover {
    box-shadow: var(--card-shadow-lg);
}

.card h2, .card h3 {
    margin-bottom: 20px;
    color: var(--text-dark);
    font-size: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
}

.page-header h2 {
    font-size: 28px;
    color: var(--text-dark);
}

.page-header > div {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.export-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    padding-right: 15px;
    border-right: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .export-buttons {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-right: 0;
        padding-bottom: 10px;
        width: 100%;
    }
    
    .header-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    
    .header-actions .export-buttons {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    .header-actions .btn-primary {
        width: 100%;
    }
    
    /* User Menu Mobile */
    .user-profile-trigger {
        padding: 4px 8px 4px 4px;
    }
    
    .user-info-text {
        display: none;
    }
    
    .user-photo,
    .user-photo-placeholder {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .dropdown-arrow {
        display: none;
    }
    
    .user-dropdown-menu {
        right: 0;
        left: auto;
        min-width: 200px;
    }
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-info:hover {
    background: #2563eb;
}

/* Tombol Copy - Teal/Cyan */
.btn-copy {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
    border: none;
}

.btn-copy:hover {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Table action buttons container */
.table-actions,
.user-table-actions {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
    justify-content: flex-end;
    min-width: 100px;
}

.table-actions .btn,
.user-table-actions .btn {
    flex-shrink: 0;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn i {
    margin-right: 5px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-light);
    font-size: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.filter-form .form-row {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    position: relative;
}

/* Ensure action buttons are always visible */
.table-responsive .table th:last-child,
.table-responsive .table td:last-child {
    position: sticky;
    right: 0;
    background: white;
    z-index: 10;
    padding-left: 20px;
    padding-right: 20px;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.05);
}

.table-responsive .table tbody tr:hover td:last-child {
    background: var(--bg-color);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table thead {
    background: var(--bg-color);
}

.table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border-color);
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    word-wrap: break-word;
    max-width: 300px;
}

.table td:last-child {
    max-width: none;
    white-space: nowrap;
    min-width: 120px;
}

.table tbody tr:hover {
    background: var(--bg-color);
}

/* Table actions column - always visible */
.table th:last-child,
.table td:last-child {
    position: sticky;
    right: 0;
    background: white;
    z-index: 10;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.05);
}

.table tbody tr:hover td:last-child {
    background: var(--bg-color);
}

/* Text overflow for long content */
.table td:not(:last-child) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Allow wrapping for description columns */
.table td[data-wrap="true"] {
    white-space: normal;
    word-wrap: break-word;
    max-width: 400px;
}

.text-center {
    text-align: center;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

/* Statistics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-income .stat-icon {
    background: var(--success-color);
}

.stat-expense .stat-icon {
    background: var(--danger-color);
}

.stat-balance .stat-icon {
    background: var(--primary-color);
}

.stat-transaction .stat-icon {
    background: var(--info-color);
}

.stat-content h3 {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 5px;
    font-weight: normal;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-dark);
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.summary-card .label {
    font-size: 14px;
    color: var(--text-light);
}

.summary-card .value {
    font-size: 20px;
    font-weight: bold;
}

/* Year Summary */
.year-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.summary-item {
    padding: 15px;
    background: var(--bg-color);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.summary-item .label {
    font-size: 14px;
    color: var(--text-light);
}

.summary-item .value {
    font-size: 18px;
    font-weight: bold;
}

/* Text Colors */
.text-success {
    color: var(--success-color);
}

.text-danger {
    color: var(--danger-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-info {
    color: var(--info-color);
}


/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 400px;
    margin-top: 20px;
    padding: 10px;
    width: 100%;
    min-height: 300px;
}

.chart-container canvas {
    max-height: 100%;
    max-width: 100%;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px;
    border-top: 1px solid var(--border-color);
}

.pagination-info {
    font-size: 14px;
    color: var(--text-light);
}

/* Responsive - Tablet and Mobile */
@media (max-width: 1024px) {
    .content-area {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .summary-cards {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    
    .modal-content {
        max-width: 90%;
        padding: 25px;
    }
    
    .modal-fullscreen-box {
        width: 95%;
        max-width: 95%;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    /* Sidebar */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.collapsed {
        width: 280px;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .sidebar.collapsed ~ .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
        font-size: 18px;
        padding: 8px;
    }
    
    /* Topbar */
    .topbar {
        padding: 12px 15px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .topbar-left {
        flex: 1;
        min-width: 0;
    }
    
    .topbar h1 {
        font-size: 18px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin: 0;
    }
    
    .topbar-right {
        flex-shrink: 0;
    }
    
    /* Content Area */
    .content-area {
        padding: 15px 10px;
    }
    
    /* Cards */
    .card {
        padding: 20px 15px;
        margin-bottom: 15px;
    }
    
    .card h2, .card h3 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    /* Page Header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .page-header h2 {
        font-size: 22px;
    }
    
    .header-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .export-buttons {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-right: 0;
        padding-bottom: 10px;
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .header-actions .btn-primary {
        width: 100%;
    }
    
    /* Statistics */
    .stats-grid,
    .summary-cards,
    .year-summary {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px;
        gap: 15px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    /* Forms */
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .filter-form .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    /* Tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -10px;
        padding: 0 10px;
    }
    
    .table {
        font-size: 12px;
        min-width: 600px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
        white-space: nowrap;
    }
    
    .table th:first-child,
    .table td:first-child {
        position: sticky;
        left: 0;
        background: white;
        z-index: 5;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
        padding-left: 10px;
    }
    
    .table thead th:first-child {
        background: var(--bg-color);
        z-index: 6;
    }
    
    .table tbody tr:hover td:first-child {
        background: var(--bg-color);
    }
    
    /* Table Actions */
    .table-actions,
    .user-table-actions {
        flex-direction: column;
        gap: 5px;
        min-width: 80px;
    }
    
    .table-actions .btn,
    .user-table-actions .btn {
        width: 100%;
        padding: 6px 10px;
        font-size: 11px;
    }
    
    /* Buttons */
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .btn-sm {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .btn i {
        margin-right: 4px;
    }
    
    /* Modals */
    .modal-content {
        max-width: 95%;
        width: 95%;
        padding: 20px 15px;
        max-height: 85vh;
    }
    
    .modal-header {
        padding-bottom: 12px;
        margin-bottom: 15px;
    }
    
    .modal-header h3 {
        font-size: 18px;
    }
    
    .modal-body {
        margin-bottom: 15px;
        font-size: 14px;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 10px;
        padding-top: 12px;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* Fullscreen Modal */
    .modal-fullscreen-box {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .modal-fullscreen-header {
        padding: 12px 15px;
    }
    
    .modal-fullscreen-header h2 {
        font-size: 16px;
    }
    
    .modal-fullscreen-body {
        padding: 15px;
    }
    
    /* Sub Type Modal */
    .subtype-modal-container {
        width: 100%;
        max-width: 100%;
    }
    
    .subtype-modal-header {
        padding: 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .subtype-modal-header h2 {
        font-size: 18px;
    }
    
    .subtype-action-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .subtype-info-section {
        flex-direction: column;
        gap: 10px;
    }
    
    .subtype-info-item {
        width: 100%;
        min-width: auto;
    }
    
    .subtype-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .subtype-table {
        min-width: 600px;
        font-size: 12px;
    }
    
    .subtype-table th,
    .subtype-table td {
        padding: 10px 12px;
    }
    
    .subtype-actions {
        flex-direction: column;
        gap: 5px;
        min-width: 100px;
    }
    
    .subtype-actions .btn {
        width: 100%;
        padding: 6px 10px;
        font-size: 11px;
    }
    
    /* Simple Modal */
    .modal-simple-box {
        width: 95%;
        max-width: 95%;
        margin: 10px;
    }
    
    .modal-simple-header {
        padding: 15px;
    }
    
    .modal-simple-header h3 {
        font-size: 18px;
    }
    
    .modal-simple-body {
        padding: 15px;
    }
    
    /* Login Page */
    .login-page {
        padding: 15px;
    }
    
    .login-box {
        padding: 30px 20px;
    }
    
    .login-box h1 {
        font-size: 24px;
    }
    
    /* User Menu */
    .user-profile-trigger {
        padding: 4px 8px 4px 4px;
    }
    
    .user-info-text {
        display: none;
    }
    
    .user-photo,
    .user-photo-placeholder {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .dropdown-arrow {
        display: none;
    }
    
    .user-dropdown-menu {
        right: 0;
        left: auto;
        min-width: 200px;
        max-width: calc(100vw - 20px);
    }
    
    /* Pagination */
    .pagination {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
        padding: 15px 10px;
    }
    
    .pagination-info {
        text-align: center;
    }
    
    /* Charts Grid */
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    /* Chart Container */
    .chart-container {
        height: 300px;
        padding: 5px;
        min-height: 250px;
    }
    
    .chart-container canvas {
        width: 100% !important;
        height: auto !important;
    }
    
    /* Badges */
    .badge {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    /* Alerts */
    .alert {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* Overlay for mobile sidebar */
@media (max-width: 768px) {
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        transition: opacity 0.3s ease;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

/* Extra Small Devices */
@media (max-width: 480px) {
    .topbar h1 {
        font-size: 16px;
    }
    
    .page-header h2 {
        font-size: 20px;
    }
    
    .card h2, .card h3 {
        font-size: 16px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .table {
        font-size: 11px;
    }
    
    .table th,
    .table td {
        padding: 8px 6px;
    }
    
    .btn {
        padding: 8px 14px;
        font-size: 12px;
    }
    
    .modal-content {
        padding: 15px 12px;
    }
    
    .modal-header h3 {
        font-size: 16px;
    }
    
    .login-box {
        padding: 25px 15px;
    }
    
    .login-box h1 {
        font-size: 20px;
    }
    
    .content-area {
        padding: 12px 8px;
    }
    
    /* Charts Grid - Extra Small */
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    /* Chart Container - Extra Small */
    .chart-container {
        height: 250px;
        min-height: 200px;
        padding: 5px;
    }
}

/* Touch-friendly elements - ensure minimum touch target size (44x44px) */
@media (max-width: 768px) {
    .btn,
    .sidebar-toggle,
    .modal-close,
    .modal-fullscreen-close,
    .modal-simple-close,
    .subtype-modal-close,
    .table-actions .btn,
    .user-table-actions .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .sidebar-nav a {
        min-height: 44px;
        padding: 12px 20px;
    }
    
    .dropdown-item {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    .user-profile-trigger {
        min-height: 44px;
    }
    
    /* Prevent text selection on buttons for better mobile UX */
    .btn,
    .sidebar-toggle,
    .sidebar-nav a {
        -webkit-tap-highlight-color: rgba(79, 70, 229, 0.2);
        -webkit-touch-callout: none;
        user-select: none;
    }
    
    /* Improve scrolling on mobile */
    .table-responsive,
    .subtype-table-wrapper,
    .modal-body,
    .modal-fullscreen-body {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Better spacing for mobile forms */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
        min-height: 44px;
    }
    
    /* Improve modal scrolling */
    .modal-content,
    .modal-simple-box,
    .modal-fullscreen-box {
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Landscape orientation adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .modal-content,
    .modal-simple-box {
        max-height: 85vh;
    }
    
    .modal-fullscreen-box {
        max-height: 95vh;
    }
    
    .chart-container {
        height: 250px;
    }
}

