
/* Global Styles */
* {
    box-sizing: border-box;
}

body {
    background-color: #f5f6fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    color: #333;
}

a {
    color: inherit;
    text-decoration: none;
}

.header {
    background-color: #5a3ba2;
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header img {
    height: 25px;
}

.header-title {
    font-size: 1.1rem;
    font-weight: 500;
}

.container {
    max-width: 900px;
    width: 95%;
    margin: 2.5rem auto;
    background-color: white;
    padding: 1.75rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* Two-section layout */
.ledger-section {
    margin-bottom: 3rem;
    padding-bottom: 3rem;
    border-bottom: 2px solid #e5e5e5;
}

.donation-section {
    margin-top: 3rem;
}

h1, h2 {
    color: #5a3ba2;
    margin-top: 0;
    margin-bottom: 1.25rem;
    text-align: center;
}

.subtitle {
    text-align: center;
    font-size: 0.95rem;
    color: #666;
    margin-top: -0.75rem;
    margin-bottom: 1.5rem;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    font-size: 0.95rem;
}

table thead {
    background-color: #5a3ba2;
    color: white;
}

table thead tr {
    background-color: #5a3ba2 !important;
}

table th, table td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

table tbody tr:hover {
    background-color: #f0edfa;
}

table tr.current-address-row {
    background-color: #f0edfa;
}

table tr.current-address-row:hover {
    background-color: #e6e0f7;
}

.amount-cell {
    white-space: nowrap;
    font-weight: 600;
}

footer {
    text-align: center;
    font-size: 0.85rem;
    color: #888;
    margin: 2rem 0 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #5a3ba2;
    color: white;
    padding: 9px 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn:hover {
    background-color: #49308d;
}

.btn-secondary {
    background-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
}

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

.btn-icon-only {
    padding: 6px 8px;
    border-radius: 50%;
    justify-content: center;
}

.actions-cell {
    white-space: nowrap;
    text-align: center;
}

.top-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1rem;
}

.stats {
    font-size: 0.9rem;
    color: #555;
}

/* Forms */
form {
    margin-top: 1rem;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    font-family: inherit;
}

textarea {
    min-height: 80px;
    resize: vertical;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.form-col {
    flex: 1 1 150px;
    min-width: 0;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.badge {
    display: inline-block;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 0.8rem;
    background-color: #f0edfa;
    color: #5a3ba2;
}

.login-wrapper {
    max-width: 400px;
}

.cf-turnstile {
    margin-bottom: 1rem;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.link {
    color: #5a3ba2;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Donation Section - Sleek Design */
.donation-section {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    border: 1px solid #e5e5e5;
}

.donation-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: #5a3ba2;
}

.donation-header i {
    font-size: 1.1rem;
}

.donation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.donation-card {
    background: #f8f9fa;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.donation-card:hover {
    border-color: #5a3ba2;
    box-shadow: 0 2px 8px rgba(90, 59, 162, 0.1);
}

.donation-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.coin-info {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.coin-symbol {
    font-weight: 700;
    font-size: 0.95rem;
    color: #333;
}

.coin-name {
    font-size: 0.8rem;
    color: #888;
}

.history-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #5a3ba2;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 0.9rem;
    text-decoration: none;
}

.history-btn:hover {
    background: #f0edfa;
    color: #49308d;
}

.address-box {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.address-field {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    background: white;
    color: #333;
    transition: border-color 0.2s;
}

.address-field:focus {
    outline: none;
    border-color: #5a3ba2;
}

.copy-address-btn {
    padding: 0.6rem 0.9rem;
    background: #5a3ba2;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.copy-address-btn:hover {
    background: #49308d;
}

.copy-address-btn.copied {
    background: #28a745;
}

/* Backup Address Section */
.backup-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e5e5;
}

.backup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    cursor: pointer;
    font-size: 0.85rem;
    color: #666;
    transition: color 0.2s;
}

.backup-header:hover {
    color: #5a3ba2;
}

.backup-header i:first-child {
    color: #5a3ba2;
    font-size: 0.9rem;
}

.backup-chevron {
    color: #5a3ba2;
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.backup-content {
    margin-top: 1rem;
}

.backup-description {
    margin: 0 0 1rem 0;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
}

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

.backup-card {
    background: #f8f9fa;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.backup-card:hover {
    border-color: #5a3ba2;
    box-shadow: 0 2px 8px rgba(90, 59, 162, 0.1);
    background: white;
}

.backup-card-icon {
    width: 36px;
    height: 36px;
    background: #5a3ba2;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}

.backup-card-coin {
    flex: 1;
    min-width: 0;
}

.backup-card-symbol {
    font-weight: 700;
    font-size: 0.9rem;
    color: #333;
}

.backup-card-name {
    font-size: 0.75rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.backup-result {
    margin-top: 1rem;
}

.backup-address-result {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
}

.backup-coin-label {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #333;
    font-size: 0.9rem;
}

.backup-address-box {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    align-items: center;
}

.backup-address-field {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    background: white;
    color: #333;
    transition: border-color 0.2s;
}

.backup-address-field:focus {
    outline: none;
    border-color: #5a3ba2;
}

.copy-backup-btn {
    padding: 0.6rem 0.9rem;
    background: #5a3ba2;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.copy-backup-btn:hover {
    background: #49308d;
}

.backup-address-note {
    font-size: 0.8rem;
    color: #666;
    padding: 0.75rem;
    background: #fff8e1;
    border-radius: 6px;
    border-left: 3px solid #ffc107;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    line-height: 1.5;
}

.backup-address-note i {
    color: #ffc107;
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.backup-unavailable {
    background: #fee;
    color: #721c24;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    line-height: 1.5;
}

.backup-unavailable i {
    flex-shrink: 0;
    margin-top: 0.1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: #5a3ba2;
    color: white;
    padding: 1.25rem 1.5rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: white;
}

.modal-close {
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #ddd;
}

.modal-body {
    padding: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    padding: 1rem;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #f9f9f9;
}

.history-item.current {
    background: #f0edfa;
    border-color: #5a3ba2;
}

.history-status {
    margin-bottom: 0.5rem;
}

.history-address {
    font-family: monospace;
    font-size: 0.9rem;
    padding: 8px 10px;
    background: white;
    border-radius: 6px;
    word-break: break-all;
    margin-bottom: 0.5rem;
}

.history-dates {
    color: #666;
    font-size: 0.85rem;
}

/* Mobile */
@media (max-width: 600px) {
    .container {
        margin: 1.5rem auto;
        padding: 1.25rem 1rem;
    }

    .header {
        padding: 0.75rem 1rem;
    }

    .header-title {
        font-size: 1rem;
    }

    table th, table td {
        padding: 8px 6px;
    }

    .top-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-actions {
        justify-content: stretch;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .donation-section {
        padding: 1rem;
    }

    .donation-grid {
        grid-template-columns: 1fr;
    }

    .address-field {
        font-size: 0.75rem;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }

    .modal-body {
        padding: 1rem;
        max-height: 400px;
    }
}
