:root {
    --primary: #1a5276;
    --primary-light: #2980b9;
    --accent: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --bg: #f0f4f8;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #dce1e6;
    --shadow: 0 10px 40px rgba(0,0,0,0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.header::after {
    content: '';
    position: absolute;
    bottom: -60%;
    left: -5%;
    width: 300px;
    height: 300px;
    background: rgba(255,255,255,0.03);
    border-radius: 50%;
}

.header-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    position: relative;
    z-index: 1;
    text-align: center;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

.voucher-badge {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 1rem;
    border: 1px solid rgba(255,255,255,0.3);
}

/* Main Content */
.main {
    flex: 1;
    max-width: 700px;
    width: 100%;
    margin: -2rem auto 2rem;
    padding: 0 1.5rem;
    position: relative;
    z-index: 2;
}

/* Card */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 2.5rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* Form */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    color: var(--text);
}

.form-group label .required {
    color: var(--accent);
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #fafbfc;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    background: white;
    box-shadow: 0 0 0 4px rgba(41,128,185,0.1);
}

.form-control.kayas-input {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-align: center;
    text-transform: uppercase;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Terms Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 16px;
    max-width: 700px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.1rem;
    color: var(--primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
    padding: 0 0.3rem;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
}

.modal-body h3 {
    font-size: 0.95rem;
    color: var(--primary);
    margin: 1.2rem 0 0.5rem 0;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p {
    margin-bottom: 0.5rem;
}

/* Terms page */
.terms-content {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text);
}

.terms-content h3 {
    font-size: 0.95rem;
    color: var(--primary);
    margin: 1.5rem 0 0.5rem 0;
}

.terms-content h3:first-child {
    margin-top: 0;
}

.terms-content p {
    margin-bottom: 0.5rem;
}

.terms-content ul {
    margin: 0.5rem 0 0.5rem 1.5rem;
}

.terms-content ul li {
    margin-bottom: 0.3rem;
}

/* Terms checkbox */
.terms-group {
    margin-bottom: 0.5rem;
}

.terms-label {
    display: flex !important;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.9rem !important;
    font-weight: 400 !important;
    color: var(--text);
    cursor: pointer;
    line-height: 1.4;
}

.terms-label input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    min-width: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.terms-label a {
    color: var(--primary-light);
    text-decoration: underline;
}

.terms-label a:hover {
    color: var(--primary);
}

/* Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 2rem;
    border: none;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(26,82,118,0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26,82,118,0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Result */
.result-box {
    display: none;
    padding: 2rem;
    border-radius: 14px;
    text-align: center;
    margin-top: 1.5rem;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-box.success {
    display: block;
    background: linear-gradient(135deg, #d5f5e3 0%, #a9dfbf 100%);
    border: 2px solid var(--success);
}

.result-box.fail {
    display: block;
    background: linear-gradient(135deg, #fadbd8 0%, #f1948a 100%);
    border: 2px solid var(--accent);
}

.result-box.warning {
    display: block;
    background: linear-gradient(135deg, #fef9e7 0%, #f9e79f 100%);
    border: 2px solid var(--warning);
}

.warning .result-title { color: #7d6608; }

.result-icon {
    font-size: 3.5rem;
    margin-bottom: 0.75rem;
}

.result-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.result-text {
    font-size: 1rem;
    opacity: 0.85;
    line-height: 1.5;
}

.success .result-title { color: #1e8449; }
.fail .result-title { color: #c0392b; }

/* Info Section */
.info-section {
    max-width: 700px;
    width: 100%;
    margin: 0 auto 2rem;
    padding: 0 1.5rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.info-item {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.info-item .icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.info-item h3 {
    font-size: 0.95rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.info-item p {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Footer */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-light);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    background: white;
}

/* Loading Spinner */
.spinner {
    display: none;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    z-index: 9999;
    animation: slideIn 0.4s ease;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast.error { background: var(--accent); }
.toast.success { background: var(--success); }

/* Responsive */
@media (max-width: 600px) {
    .header-content { padding: 2rem 1.5rem; }
    .header h1 { font-size: 1.5rem; }
    .voucher-badge { font-size: 1.2rem; }
    .card { padding: 1.5rem; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .info-grid { grid-template-columns: 1fr; }
    .main { padding: 0 1rem; }
}

/* Admin Styles */
.admin-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

.admin-header .header-content {
    max-width: 100%;
    padding: 2rem 2rem;
}

.admin-nav {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.admin-nav a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.admin-nav a:hover, .admin-nav a.active {
    background: rgba(255,255,255,0.15);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
}

.data-table th:first-child {
    border-radius: 8px 0 0 0;
}

.data-table th:last-child {
    border-radius: 0 8px 0 0;
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.data-table tr:hover td {
    background: #f7f9fc;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success {
    background: #d5f5e3;
    color: #1e8449;
}

.badge-fail {
    background: #fadbd8;
    color: #c0392b;
}

.badge-warning {
    background: #fef9e7;
    color: #7d6608;
}

.upload-zone {
    border: 3px dashed var(--border);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary-light);
    background: rgba(41,128,185,0.05);
}

.upload-zone .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.upload-zone p {
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.main.admin-main {
    max-width: 100%;
    padding: 0 2rem;
    margin: -2rem 0 2rem;
}

.login-card {
    max-width: 400px;
    margin: 3rem auto;
}

.btn-danger {
    background: var(--accent);
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}

.btn-secondary {
    background: #ecf0f1;
    color: var(--text);
}

.btn-secondary:hover {
    background: #dce1e6;
}

.table-wrapper {
    overflow-x: auto;
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success {
    background: #d5f5e3;
    color: #1e8449;
    border: 1px solid #a9dfbf;
}

.alert-error {
    background: #fadbd8;
    color: #c0392b;
    border: 1px solid #f1948a;
}

.alert-info {
    background: #d6eaf8;
    color: #1a5276;
    border: 1px solid #aed6f1;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.pagination a, .pagination span {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    color: var(--text);
}

.pagination a:hover {
    background: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
}

.pagination .current {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Activity Log */
.activity-log {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.activity-item {
    background: #f8f9fa;
    border-radius: 0 10px 10px 0;
    padding: 0.85rem 1rem;
}

.activity-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.activity-badge {
    display: inline-block;
    color: white;
    padding: 0.2rem 0.7rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.activity-meta {
    font-size: 0.82rem;
    color: var(--text-light);
}

.activity-note {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text);
}

.link-view {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.link-view:hover {
    background: rgba(41,128,185,0.1);
}
