/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
header {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    text-align: center;
}

header h1 {
    color: #667eea;
    font-size: 1.8em;
    margin-bottom: 10px;
}

header .subtitle {
    color: #666;
    font-size: 1em;
    line-height: 1.5;
}

header .subtitle strong {
    color: #667eea;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

/* Stat Cards */
.stat-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px !important;
}

.stat-icon {
    font-size: 2.5em;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.stat-card.total .stat-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stat-card.target .stat-icon {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.stat-card.sisa .stat-icon {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
}

.stat-card.hari .stat-icon {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.3em;
    font-weight: 700;
    color: #333;
}

/* Cards */
.card {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.3em;
}

.card h2 i {
    color: #667eea;
    margin-right: 10px;
}

/* Progress Card */
.progress-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.progress-card h2 {
    color: white;
}

.progress-card h2 i {
    color: white;
}

.progress-card .progress-bar-container {
    background: rgba(255, 255, 255, 0.3);
    margin-bottom: 15px;
}

.progress-card .progress-bar {
    background: white;
}

.progress-card .progress-bar span {
    color: #667eea;
}

.progress-detail {
    text-align: center;
    font-size: 1.1em;
    font-weight: 600;
}

/* Setor Card */
.setor-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.setor-success,
.setor-reminder {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.setor-success i,
.setor-reminder i {
    font-size: 3em;
}

.setor-success h3,
.setor-reminder h3 {
    font-size: 1.4em;
    margin-bottom: 5px;
}

.setor-form {
    margin-top: 15px;
}

.btn-setor {
    width: 100%;
    background: white !important;
    color: #f5576c !important;
    font-size: 1.2em !important;
    padding: 15px !important;
}

.btn-setor:hover {
    transform: scale(1.02);
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: 500;
    transition: opacity 0.3s;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert i {
    margin-right: 8px;
}

/* Forms */
.form-manual,
.form-settings {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.form-group label i {
    color: #667eea;
    margin-right: 5px;
}

input[type="text"],
input[type="date"],
input[type="number"],
textarea {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s;
    font-family: inherit;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Buttons */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.btn-sm {
    padding: 8px 15px;
    font-size: 0.9em;
}

/* Progress Bar */
.progress-bar-container {
    background: #e0e0e0;
    border-radius: 25px;
    height: 40px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.5s ease;
    border-radius: 25px;
    min-width: 50px;
}

.progress-bar span {
    color: white;
    font-weight: 700;
    font-size: 1.1em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Table */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.table th {
    font-weight: 600;
    font-size: 0.9em;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

.table i {
    margin-right: 5px;
}

/* Badge */
.badge {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state i {
    font-size: 4em;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.1em;
}

/* Settings Card */
.settings-card summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 1.3em;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s;
}

.settings-card summary:hover {
    background: #f8f9fa;
}

.settings-card[open] summary {
    margin-bottom: 20px;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    body {
        padding: 8px;
    }

    header {
        padding: 15px;
    }

    header h1 {
        font-size: 1.5em;
    }

    header .subtitle {
        font-size: 0.9em;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
        padding: 15px !important;
        gap: 10px;
    }

    .stat-icon {
        font-size: 2em;
        width: 50px;
        height: 50px;
    }

    .stat-value {
        font-size: 1.1em;
    }

    .card {
        padding: 15px;
    }

    .card h2 {
        font-size: 1.1em;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .setor-success,
    .setor-reminder {
        flex-direction: column;
        text-align: center;
    }

    .setor-success h3,
    .setor-reminder h3 {
        font-size: 1.2em;
    }

    .btn-setor {
        font-size: 1em !important;
    }

    .table th,
    .table td {
        padding: 8px;
        font-size: 0.85em;
    }

    .hide-mobile {
        display: none;
    }

    .btn-sm {
        padding: 6px 10px;
        font-size: 0.8em;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.3em;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
    }

    .stat-value {
        font-size: 1em;
    }

    .progress-bar-container {
        height: 35px;
    }

    .progress-bar span {
        font-size: 1em;
    }

    input[type="text"],
    input[type="date"],
    input[type="number"] {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease;
}

/* Touch-friendly improvements for mobile */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px; /* Apple's recommended minimum touch target */
    }

    .table th,
    .table td {
        min-height: 44px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .btn,
    .setor-form,
    .form-manual,
    .settings-card {
        display: none;
    }

    .card {
        box-shadow: none;
        page-break-inside: avoid;
    }
}

/* Header */
header {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    text-align: center;
}

header h1 {
    color: #667eea;
    font-size: 2em;
    margin-bottom: 10px;
}

header .subtitle {
    color: #666;
    font-size: 1.1em;
}

.back-button {
    display: inline-block;
    padding: 10px 20px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.back-button:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

/* Cards */
.card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
    transition: all 0.3s;
}

.card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.card h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.card h2 i {
    color: #667eea;
    margin-right: 10px;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: 500;
    transition: opacity 0.3s;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert i {
    margin-right: 8px;
}

/* Forms */
.form-inline {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

input[type="text"],
input[type="date"],
input[type="number"],
textarea,
select {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s;
    font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Buttons */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.btn-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.btn-sm {
    padding: 8px 15px;
    font-size: 0.9em;
}

/* Pelanggan Cards */
.pelanggan-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 25px;
}

.pelanggan-card {
    border-left: 5px solid #667eea;
}

.pelanggan-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.pelanggan-info h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.4em;
}

.pelanggan-info p {
    color: #666;
    margin-bottom: 5px;
}

.pelanggan-info i {
    color: #667eea;
    margin-right: 8px;
    width: 20px;
}

/* Status Badge */
.status-badge {
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 700;
    text-align: center;
}

.status-badge.aktif {
    background: #d4edda;
    color: #155724;
}

.status-badge.lunas {
    background: #cce5ff;
    color: #004085;
}

.status-badge.nonaktif {
    background: #f8d7da;
    color: #721c24;
}

/* Progress Section */
.progress-section {
    margin: 20px 0;
}

.progress-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.progress-info > div {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.progress-info strong {
    display: block;
    color: #666;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.progress-bar-container {
    background: #e0e0e0;
    border-radius: 25px;
    height: 40px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.5s ease;
    border-radius: 25px;
    min-width: 50px;
}

.progress-bar span {
    color: white;
    font-weight: 700;
    font-size: 1.1em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    color: white;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 1.5em;
    font-weight: 700;
}

/* Action Section */
.action-section {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.setor-hari-ini {
    flex: 1;
    padding: 12px 25px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Table */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.table th,
.table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.table th {
    font-weight: 600;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

.table i {
    margin-right: 5px;
}

/* Badge */
.badge {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state i {
    font-size: 4em;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.1em;
}

/* Detail Header */
.pelanggan-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.pelanggan-detail-header h2 {
    margin-bottom: 15px;
    color: #667eea;
}

.pelanggan-detail-header p {
    color: #666;
    margin-bottom: 8px;
}

.pelanggan-detail-header i {
    color: #667eea;
    margin-right: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .pelanggan-list {
        grid-template-columns: 1fr;
    }
    
    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-inline .form-group {
        width: 100%;
    }
    
    .action-section {
        flex-direction: column;
    }
    
    header h1 {
        font-size: 1.5em;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .card {
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease;
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .btn,
    .back-button,
    .action-section {
        display: none;
    }
    
    .card {
        box-shadow: none;
        page-break-inside: avoid;
    }
}
