/* assets/css/style.css */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    padding: 1rem;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

/* Search Form */
.search-box {
    display: flex;
    gap: 0.5rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
    justify-content: center;
}
.search-box input {
    padding: 0.75rem 1rem;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    min-width: 200px;
}
.search-box button {
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}
.search-box button:hover { background: var(--primary-dark); }

/* Flip Card */
.flip-card {
    width: 100%;
    max-width: 360px;
    height: 220px;
    margin: 1rem auto;
    perspective: 1000px;
    cursor: pointer;
}
.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}
.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}
.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.flip-card-back {
    transform: rotateY(180deg);
}
.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    padding: 1rem;
    text-align: left;
}
.card-name { font-weight: 700; font-size: 1.1rem; display: block; }
.card-number { font-size: 0.9rem; opacity: 0.9; }
.back-note {
    position: absolute;
    bottom: 1rem;
    left: 0;
    right: 0;
    text-align: center;
    color: white;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* QR Section */
.qr-section {
    display: none;
    margin: 1rem auto;
    max-width: 300px;
    text-align: center;
}
.qr-section.active { display: block; }
.qr-box {
    background: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.qr-box img {
    width: 100%;
    max-width: 250px;
    height: auto;
    display: block;
    margin: 0 auto 0.5rem;
}
.qr-url {
    font-size: 0.8rem;
    color: #64748b;
    word-break: break-all;
    margin-bottom: 1rem;
}
.btn-download, .btn-qr, .btn-flip {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    margin: 0.25rem;
    border: none;
    cursor: pointer;
}
.btn-download:hover, .btn-qr:hover, .btn-flip:hover {
    background: var(--primary-dark);
}
.btn-close {
    background: #ef4444;
    margin-top: 0.5rem;
}

/* Controls */
.card-controls {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

/* Admin Styles */
.admin-form {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin: 1rem 0;
    text-align: left;
    box-shadow: var(--shadow);
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.form-grid input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}
.form-note {
    background: #eff6ff;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin: 1rem 0;
    color: #1e40af;
}
.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}
.btn-primary { background: #10b981; }
.btn-secondary { background: #64748b; }
.btn-edit { color: #3b82f6; }
.btn-delete { color: #ef4444; }
.btn-view { color: #8b5cf6; }

/* Table */
.table-responsive { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}
th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
th { background: #f1f5f9; font-weight: 600; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Mobile Responsive */
@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
    .flip-card { height: 200px; }
    .search-box { flex-direction: column; }
    .search-box input, .search-box button { width: 100%; }
    .card-controls { flex-direction: column; align-items: center; }
}

/* Utilities */
.error { color: #ef4444; padding: 1rem; background: #fef2f2; border-radius: 8px; }
.success { color: #10b981; padding: 1rem; background: #ecfdf5; border-radius: 8px; }
.loading { color: #64748b; font-style: italic; }
.note { font-size: 0.9rem; color: #64748b; margin-top: 1rem; }
footer { margin-top: 2rem; color: #64748b; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Disable image download (basic) */
.card-img {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    pointer-events: none; /* Mencegah klik kanan langsung pada gambar */
}
/* Tapi izinkan interaksi wrapper */
.flip-card-front, .flip-card-back {
    pointer-events: auto;
}