:root {
    --bg: #FFFAF5;
    --surface: #FFFFFF;
    --primary: #D4785C;
    --primary-hover: #C0684C;
    --primary-light: #FDF0EA;
    --secondary: #3D5A80;
    --accent: #F4C542;
    --text: #2D2D2D;
    --text-light: #8A8A8A;
    --text-muted: #B0A8A0;
    --claimed: #5BBF6A;
    --claimed-bg: #F0FDF4;
    --claimed-border: #C8F0CF;
    --border: #EDE6DE;
    --shadow: 0 2px 16px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.1);
    --radius: 14px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ---- Header ---- */

header {
    background: linear-gradient(135deg, #D4785C 0%, #E8A87C 50%, #DF8C6B 100%);
    text-align: center;
    padding: 64px 24px 56px;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.15) 0%, transparent 70%);
}

.header-content {
    position: relative;
    z-index: 1;
}

header .stars {
    font-size: 1.4rem;
    color: rgba(255,255,255,0.5);
    letter-spacing: 16px;
    margin-bottom: 12px;
}

header h1 {
    font-size: 3.2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.03em;
    text-shadow: 0 2px 16px rgba(0,0,0,0.08);
    line-height: 1.2;
}

header .subtitle {
    font-size: 1.15rem;
    color: rgba(255,255,255,0.85);
    font-weight: 500;
    margin-top: 6px;
    letter-spacing: 0.02em;
}

header .names {
    font-size: 1rem;
    color: rgba(255,255,255,0.7);
    font-weight: 400;
    margin-top: 4px;
}

/* ---- Intro ---- */

.intro-section {
    max-width: 720px;
    margin: 0 auto;
    padding: 48px 24px 32px;
}

.intro-content {
    display: flex;
    align-items: center;
    gap: 36px;
}

.intro-photo {
    flex-shrink: 0;
}

.couple-photo {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary-light);
    box-shadow: var(--shadow);
}

.couple-photo.placeholder-photo {
    border-color: var(--border);
    opacity: 0.7;
}

.intro-text {
    font-size: 1.05rem;
    color: var(--text-light);
    line-height: 1.8;
}

.emoji {
    font-size: 1.2em;
}

@media (max-width: 600px) {
    .intro-content {
        flex-direction: column;
        text-align: center;
    }
    .couple-photo {
        width: 100px;
        height: 100px;
    }
}

/* ---- Gifts Grid ---- */

.gifts {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px 64px;
}

.gifts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

/* ---- Gift Card ---- */

.gift-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--border);
}

.gift-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.gift-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 20px;
    line-height: 1.4;
    flex: 1;
}

.gift-card .card-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gift-card .btn-outline {
    width: 100%;
    text-align: center;
}

/* ---- Claimed State ---- */

.gift-card.claimed {
    background: var(--claimed-bg);
    border-color: var(--claimed-border);
}

/* ---- Card Image ---- */

.card-img {
    width: calc(100% + 48px);
    margin: -24px -24px 16px;
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
    height: 180px;
    background: #F5F0EB;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gift-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 20px;
    line-height: 1.4;
    flex: 1;
}

.gift-card.claimed .card-img {
    opacity: 0.85;
}

.gift-card.claimed h3 {
    color: #3A7D44;
}

.claimed-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--claimed);
    padding: 8px 12px;
    background: rgba(91, 191, 106, 0.1);
    border-radius: var(--radius-sm);
    line-height: 1.4;
}

.claimed-tag .check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--claimed);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.claimed-tag strong {
    font-weight: 600;
}

/* ---- Buttons ---- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary-light);
}

.btn-full {
    width: 100%;
}

.btn-small {
    padding: 6px 14px;
    font-size: 0.82rem;
}

.btn-warning {
    background: #F4A542;
    color: #fff;
}

.btn-warning:hover {
    background: #E89530;
}

.btn-danger {
    background: #E06060;
    color: #fff;
}

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

.btn-logout {
    background: rgba(255,255,255,0.15);
    color: #fff;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.15s ease;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.25);
}

/* ---- PIX Section ---- */

.pix-section {
    max-width: 600px;
    margin: 0 auto 48px;
    padding: 0 24px;
}

.pix-card {
    background: linear-gradient(135deg, #3D5A80 0%, #2C4A6E 100%);
    border-radius: var(--radius);
    padding: 40px 36px;
    text-align: center;
    color: #fff;
    box-shadow: var(--shadow-lg);
}

.pix-icon {
    font-size: 2.8rem;
    margin-bottom: 8px;
}

.pix-card h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.pix-card p {
    color: rgba(255,255,255,0.8);
    font-size: 0.95rem;
    line-height: 1.7;
    max-width: 440px;
    margin: 0 auto 24px;
}

.pix-key-box {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    margin-bottom: 12px;
}

.pix-key-label {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
}

.pix-key-box code {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    word-break: break-all;
    background: none;
    padding: 0;
}

.pix-key-box .btn-copy {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: none;
    flex-shrink: 0;
}

.pix-key-box .btn-copy:hover {
    background: rgba(255,255,255,0.3);
}

.pix-recipient {
    font-size: 0.85rem !important;
    color: rgba(255,255,255,0.6) !important;
    margin-bottom: 20px !important;
}

.pix-recipient strong {
    color: rgba(255,255,255,0.9);
}

.btn-pix {
    background: var(--accent);
    color: #2C4A6E;
    font-weight: 600;
    padding: 12px 28px;
    font-size: 1rem;
}

.btn-pix:hover {
    background: #E8B832;
    color: #2C4A6E;
}

/* ---- Footer ---- */

footer {
    text-align: center;
    padding: 40px 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ---- Toast ---- */

.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    background: var(--claimed);
    color: #fff;
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.95rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(-16px) scale(0.95);
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ---- Modal ---- */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 999;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

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

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.92) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

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

.modal h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.modal .modal-text {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.modal input[type="text"],
.modal input[type="number"],
.modal select,
.modal-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease;
    margin-bottom: 10px;
    background: var(--surface);
}

.modal input[type="text"]:focus,
.modal input[type="number"]:focus,
.modal select:focus,
.modal-textarea:focus {
    border-color: var(--primary);
}

.modal-textarea {
    resize: vertical;
    min-height: 60px;
}

.modal select {
    cursor: pointer;
    appearance: auto;
}

.pix-key-copy {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.pix-key-copy span {
    color: var(--text-light);
    width: 100%;
}

.pix-key-copy code {
    flex: 1;
    font-size: 0.9rem;
    word-break: break-all;
    color: var(--text);
    background: none;
    padding: 0;
}

.modal-error {
    color: #E06060;
    font-size: 0.85rem;
    margin-top: 8px;
    min-height: 1.2em;
}

.modal .btn-full {
    margin-top: 16px;
}

/* ---- Login Page ---- */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #D4785C 0%, #E8A87C 100%);
}

.login-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-box .login-stars {
    font-size: 1.2rem;
    color: var(--text-muted);
    letter-spacing: 12px;
    margin-bottom: 8px;
}

.login-box h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
}

.login-box .login-subtitle {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 28px;
}

.login-box input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease;
    margin-bottom: 16px;
}

.login-box input[type="password"]:focus {
    border-color: var(--primary);
}

.login-box .error-msg {
    color: #E06060;
    font-size: 0.85rem;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #FEF2F2;
    border-radius: var(--radius-sm);
}

.login-box .back-link {
    display: block;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-decoration: none;
}

.login-box .back-link:hover {
    color: var(--primary);
}

/* ---- Admin Page ---- */

.admin-page {
    background: #F8F6F3;
}

.admin-header {
    background: linear-gradient(135deg, #3D5A80 0%, #293241 100%);
    padding: 24px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-header h1 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #fff;
}

.admin-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.admin-header-actions .btn-outline {
    border-color: rgba(255,255,255,0.4);
    color: rgba(255,255,255,0.85);
}

.admin-header-actions .btn-outline:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.6);
}

.admin-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

.admin-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.admin-section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-section h2 .count {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg);
    padding: 2px 10px;
    border-radius: 20px;
}

.admin-section label {
    display: block;
    font-size: 0.88rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

.admin-section code {
    background: var(--bg);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

.admin-section .hint {
    font-size: 0.82rem;
    color: var(--claimed);
    margin-top: 8px;
}

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

.input-row input {
    flex: 1;
    min-width: 180px;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.input-row input:focus,
.input-row textarea:focus {
    border-color: var(--secondary);
}

.input-row .btn {
    flex-shrink: 0;
}

/* ---- Table ---- */

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

table th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table tbody tr:hover {
    background: #FAF8F5;
}

table .row-claimed {
    background: var(--claimed-bg);
}

table .row-claimed:hover {
    background: #E8F8EC;
}

table .badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
}

table .badge-claimed {
    background: rgba(91, 191, 106, 0.15);
    color: #3A7D44;
}

table .badge-available {
    background: var(--primary-light);
    color: var(--primary);
}

table .actions-cell {
    white-space: nowrap;
}

.admin-thumb {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    background: #F0EAE4;
    display: block;
}

.msg-cell {
    max-width: 200px;
}

.msg-preview {
    color: var(--text-light);
    font-size: 0.82rem;
    cursor: help;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

.empty-state {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 8px 0;
}

.btn-copy {
    background: var(--border);
    color: var(--text-light);
    padding: 4px 12px;
    font-size: 0.78rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease;
}

.btn-copy:hover {
    background: #D8D0C8;
    color: var(--text);
}

/* ---- Edit Form ---- */

.edit-form label {
    display: block;
    font-size: 0.88rem;
    color: var(--text-light);
    margin-bottom: 6px;
    margin-top: 18px;
}

.edit-form label:first-child {
    margin-top: 0;
}

.edit-form input[type="text"],
.edit-form input[type="url"] {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.edit-form input:focus {
    border-color: var(--secondary);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
}

.edit-preview {
    margin-bottom: 20px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    max-width: 400px;
}

.edit-preview img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    border-radius: var(--radius-sm);
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
    header { padding: 48px 20px 40px; }
    header h1 { font-size: 2.2rem; }
    .intro { padding: 36px 20px 24px; }
    .gifts { padding: 0 16px 48px; }
    .gifts-grid { grid-template-columns: 1fr; }
    .admin-header { padding: 18px 20px; }
    .admin-section { padding: 20px; }
    .input-row { flex-direction: column; }
    .input-row input { min-width: 0; }
    .modal { padding: 24px; }
    .toast { left: 24px; right: 24px; text-align: center; }
}

@media (max-width: 480px) {
    header h1 { font-size: 1.8rem; }
    header .stars { font-size: 1rem; letter-spacing: 10px; }
}
