/* style.css - Full Styling untuk semua halaman */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px 20px 80px;
    color: #333;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    padding: 30px 25px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
}

/* HEADER */
header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 28px;
    color: #4a4a4a;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

header p {
    color: #888;
    font-size: 14px;
}

/* FORM */
.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #555;
    margin-bottom: 6px;
}

.required {
    color: #e74c3c;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s;
    background: white;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #999;
    font-size: 12px;
}

/* UPLOAD AREA */
.upload-area {
    border: 2px dashed #d0d5dd;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.upload-area input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-placeholder span {
    font-size: 40px;
    display: block;
}

.upload-placeholder p {
    margin: 8px 0 4px;
    color: #555;
    font-weight: 500;
}

.upload-placeholder small {
    color: #999;
    font-size: 12px;
}

.upload-preview {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.upload-preview img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.upload-preview button {
    background: #e74c3c;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.upload-preview button:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* FOLDER GROUP */
.folder-group {
    display: flex;
    gap: 10px;
}

.folder-group select {
    flex: 1;
}

.folder-group button {
    padding: 12px 18px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
}

.folder-group button:hover {
    background: #5a6fd6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

#newFolderInput {
    display: flex;
    gap: 10px;
    align-items: center;
}

#newFolderInput input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 14px;
}

#newFolderInput button {
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#saveNewFolder {
    background: #2ecc71;
    color: white;
}

#saveNewFolder:hover {
    background: #27ae60;
}

#cancelNewFolder {
    background: #e74c3c;
    color: white;
}

#cancelNewFolder:hover {
    background: #c0392b;
}

/* GENERATE BUTTON */
#generateBtn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

#generateBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

#generateBtn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* RESULT AREA */
#resultArea {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #ecf0f1;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#resultArea h2 {
    color: #2ecc71;
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
}

#qrDisplay {
    display: flex;
    gap: 30px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

#qrCanvasContainer {
    flex-shrink: 0;
    background: white;
    padding: 15px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

#qrCanvasContainer canvas {
    display: block;
    width: 200px;
    height: 200px;
}

#qrInfo {
    flex: 1;
    min-width: 200px;
}

#qrInfo p {
    margin: 8px 0;
    font-size: 14px;
    color: #555;
    word-break: break-all;
}

#qrInfo p strong {
    color: #333;
    display: inline-block;
    min-width: 60px;
}

#qrInfo #resultTeks {
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 8px;
    display: inline-block;
    max-width: 100%;
}

/* ACTION BUTTONS */
.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.action-buttons button {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

#downloadBtn {
    background: #2ecc71;
    color: white;
}

#downloadBtn:hover {
    background: #27ae60;
    transform: translateY(-2px);
}

#copyBtn {
    background: #3498db;
    color: white;
}

#copyBtn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

#newBtn {
    background: #95a5a6;
    color: white;
}

#newBtn:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
}

/* BOTTOM NAVIGATION */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    border-top: 1px solid #e1e5e9;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    z-index: 1000;
}

.bottom-nav a {
    text-decoration: none;
    color: #999;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.3s;
    padding: 4px 12px;
    border-radius: 8px;
}

.bottom-nav a.active {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.bottom-nav a:hover {
    color: #667eea;
}

/* RESPONSIVE */
@media (max-width: 480px) {
    .container {
        padding: 20px 15px;
    }

    header h1 {
        font-size: 22px;
    }

    #qrDisplay {
        flex-direction: column;
        align-items: center;
    }

    #qrCanvasContainer canvas {
        width: 150px;
        height: 150px;
    }

    .folder-group {
        flex-direction: column;
    }

    .folder-group button {
        width: 100%;
    }

    .action-buttons button {
        flex: 1;
        min-width: 100px;
    }

    #newFolderInput {
        flex-wrap: wrap;
    }
}

/* LOADING SPINNER */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* ============================================
   STYLE KHUSUS UNTUK DATABASE.HTML
   ============================================ */

/* STATISTIK */
.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 16px;
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 32px;
    font-weight: 700;
}

.stat-label {
    display: block;
    font-size: 14px;
    opacity: 0.9;
    margin-top: 4px;
}

/* SEARCH BAR */
.search-bar {
    margin-bottom: 20px;
}

.search-bar input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s;
}

.search-bar input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* FOLDER SIDEBAR */
.folder-sidebar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 12px;
}

.folder-btn {
    padding: 8px 16px;
    border: 2px solid transparent;
    border-radius: 20px;
    background: white;
    color: #555;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.folder-btn:hover {
    background: #e8ecf1;
}

.folder-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.folder-btn .badge {
    background: rgba(0,0,0,0.1);
    padding: 0 8px;
    border-radius: 12px;
    font-size: 11px;
}

.folder-btn.active .badge {
    background: rgba(255,255,255,0.2);
}

/* QR CARD LIST */
#qrList {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.qr-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 14px;
    border: 1px solid #e1e5e9;
    transition: all 0.3s;
    gap: 15px;
}

.qr-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.qr-card-left {
    display: flex;
    gap: 15px;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.qr-thumbnail {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e1e5e9;
}

.qr-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.qr-card-info {
    flex: 1;
    min-width: 0;
}

.qr-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 0 0 4px 0;
}

.qr-text {
    font-size: 13px;
    color: #777;
    margin: 0 0 6px 0;
    word-break: break-all;
}

.qr-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
    color: #999;
}

.qr-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.qr-id {
    color: #aaa;
    font-size: 11px;
}

/* QR CARD ACTIONS */
.qr-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.action-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    transform: scale(1.1);
}

.view-btn:hover {
    background: #3498db;
    color: white;
}

.download-btn:hover {
    background: #2ecc71;
    color: white;
}

.delete-btn:hover {
    background: #e74c3c;
    color: white;
}

/* EMPTY STATE */
#emptyState {
    text-align: center;
    padding: 50px 20px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

#emptyState h3 {
    color: #555;
    margin-bottom: 8px;
}

#emptyState p {
    color: #999;
}

#emptyState a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

/* MODAL */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal-content {
    background: white;
    border-radius: 24px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    transition: all 0.3s;
}

.modal-close:hover {
    color: #333;
    transform: rotate(90deg);
}

.modal-content h2 {
    margin: 0 0 16px 0;
    text-align: center;
    color: #333;
}

.modal-qr {
    text-align: center;
    margin: 16px 0;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
}

.modal-qr img {
    max-width: 100%;
    height: auto;
}

.modal-info p {
    margin: 10px 0;
    font-size: 14px;
    color: #555;
}

.modal-info p strong {
    color: #333;
}

.modal-teks {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 10px;
    margin: 8px 0 16px 0;
    word-break: break-all;
    font-size: 14px;
    color: #555;
    max-height: 100px;
    overflow-y: auto;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-download {
    background: #2ecc71;
    color: white;
}

.modal-download:hover {
    background: #27ae60;
}

.modal-copy {
    background: #3498db;
    color: white;
}

.modal-copy:hover {
    background: #2980b9;
}

/* RESPONSIVE */
@media (max-width: 480px) {
    .qr-card {
        flex-direction: column;
        align-items: stretch;
    }
    
    .qr-card-left {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .qr-thumbnail {
        width: 80px;
        height: 80px;
    }
    
    .qr-meta {
        justify-content: center;
    }
    
    .qr-card-actions {
        justify-content: center;
        padding-top: 10px;
        border-top: 1px solid #e1e5e9;
    }
    
    .stats {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .stat-number {
        font-size: 24px;
    }
    
    .modal-content {
        padding: 20px;
        margin: 10px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

@media (max-width: 380px) {
    .folder-sidebar {
        flex-direction: column;
    }
    
    .folder-btn {
        justify-content: center;
    }
}