:root {
    --primary: #5c6ac4;
    --primary-dark: #404aa6;
    --primary-light: #e7e9fc;
    --bg: #f6f7fb;
    --card-bg: #fff;
    --text: #22223b;
    --subtle: #868686;
    --success: #34c759;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 6px 24px 0 rgba(92,106,196,0.07);
    --transition: all 0.2s ease-in-out;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
    letter-spacing: 0.01em;
}

/* ===== HEADER STYLES ===== */
header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 22px 0;
    box-shadow: 0 2px 12px rgba(92,106,196,0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.8em;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.03em;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    position: relative;
}

header h1::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 40px;
    height: 3px;
    background: rgba(255,255,255,0.6);
    border-radius: 2px;
}

header .emoji {
    margin-right: 8px;
    font-size: 1.1em;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
}

nav {
    display: flex;
    align-items: center;
}

nav a {
    color: #fff;
    text-decoration: none;
    margin-left: 24px;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

nav a::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: #fff;
    transition: width 0.3s;
}

nav a:hover::before {
    width: 80%;
}

nav a.highlight, nav a:hover {
    background: rgba(255,255,255,0.15);
    transform: translateY(-2px);
}

.site-title-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.site-title-link:hover {
    transform: scale(1.02);
}

.site-title-link:hover h1 {
    opacity: 0.95;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 30px 16px;
    flex: 1 0 auto;
}

main.container {
    flex: 1 0 auto;
}

/* ===== CARD STYLES ===== */
.card {
    background: var(--card-bg);
    padding: 26px 28px 14px 28px;
    margin-bottom: 26px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.15s, box-shadow 0.2s;
    border: 1px solid var(--primary-light);
    position: relative;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 14px 36px 0 rgba(92,106,196,0.12);
}

.card .meta {
    color: var(--subtle);
    font-size: 0.95em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card .actions {
    margin-top: 18px;
}

.preview {
    color: var(--text);
    font-size: 1.1em;
    margin-bottom: 10px;
    line-height: 1.6;
    word-break: break-word;
}

.read-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 1em;
    display: inline-flex;
    align-items: center;
    position: relative;
    padding-bottom: 2px;
    transition: var(--transition);
}

.read-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary);
    transition: width 0.3s;
}

.read-link:hover::after {
    width: 100%;
}

.read-link:hover {
    color: var(--primary-dark);
}

/* ===== FORMS ===== */
form {
    background: var(--card-bg);
    padding: 28px 26px 24px 26px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 34px;
    border: 1px solid var(--primary-light);
}

textarea, input[type="text"], select {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid #d3d3f3;
    font-size: 1.08em;
    margin-bottom: 18px;
    transition: border 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

textarea:focus, input[type="text"]:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(92,106,196,0.1);
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

small {
    color: var(--subtle);
    font-size: 0.9em;
    display: block;
    margin-top: -12px;
    margin-bottom: 16px;
}

button, input[type="submit"] {
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 28px;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
    transition: transform 0.15s, box-shadow 0.2s;
    letter-spacing: 0.02em;
}

button:hover, input[type="submit"]:hover {
    background: linear-gradient(to right, var(--primary-dark), var(--primary));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(92,106,196,0.2);
}

/* ===== COMMENT SECTION ===== */
.comment-section {
    margin-top: 45px;
    margin-bottom: 15px;
}

.comment-section h3 {
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
}

.comment-section h3::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

.comment-card {
    background: #f8f9ff;
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    margin-bottom: 15px;
    border-left: 4px solid var(--primary);
    transition: transform 0.15s, box-shadow 0.2s;
}

.comment-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(92,106,196,0.08);
}

.comment-card .meta {
    color: var(--subtle);
    font-size: 0.92em;
    margin-bottom: 4px;
}

/* ===== SHARE STYLES ===== */
.share-modern-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.share-modern-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(92,106,196,0.2);
}

.share-modern-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(92,106,196,0.3);
}

.share-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(to right, #f6f8ff, #eef1ff);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    box-shadow: 0 3px 10px 0 rgba(92,106,196,0.08);
    margin: 12px 0 8px 0;
    border: 1px solid #e2e6f9;
    gap: 12px;
    max-width: 100%;
    overflow-x: auto;
}

.share-link-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
    overflow-x: auto;
}

.share-link-icon {
    min-width: 22px;
    min-height: 22px;
    opacity: 0.8;
}

.share-url {
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 1em;
    color: #364;
    background: transparent;
    border: none;
    outline: none;
    padding: 0;
    margin: 0;
    white-space: nowrap;
    overflow-x: auto;
    text-overflow: ellipsis;
    max-width: 60vw;
    display: block;
    scrollbar-width: thin;
}

.share-url::-webkit-scrollbar {
    height: 4px;
}

.share-url::-webkit-scrollbar-thumb {
    background-color: rgba(92,106,196,0.2);
    border-radius: 2px;
}

.share-copy-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 18px;
    font-size: 1.03em;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    min-width: 70px;
    user-select: none;
    box-shadow: 0 2px 6px rgba(92,106,196,0.15);
}

.share-copy-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(92,106,196,0.25);
}

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

.share-copy-label {
    font-size: 1em;
    transition: color 0.12s;
}

/* ===== SUGGESTIONS ===== */
.suggestion-section {
    margin-top: 40px;
    margin-bottom: 30px;
}

.suggestion-section h3 {
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
}

.suggestion-section h3::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

.suggestion-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.suggestion-block {
    flex: 1 1 180px;
    min-width: 0;
    max-width: 240px;
}

.suggestion-title {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
    font-size: 1.05em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.suggestion-card {
    background: linear-gradient(to right, #f8f9ff, #f3f5ff);
    border-radius: var(--radius-sm);
    padding: 14px 16px 10px;
    margin-bottom: 12px;
    cursor: pointer;
    border: 1px solid #e2e6f9;
    transition: var(--transition);
    box-shadow: 0 2px 8px 0 rgba(92,106,196,0.05);
    position: relative;
    overflow: hidden;
}

.suggestion-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 0;
    background: var(--primary);
    transition: height 0.2s;
}

.suggestion-card:hover {
    background: #e7e9fc;
    box-shadow: 0 8px 20px 0 rgba(92,106,196,0.12);
    transform: translateY(-2px);
}

.suggestion-card:hover::after {
    height: 100%;
}

.suggestion-preview {
    font-size: 1.01em;
    color: var(--text);
    margin-bottom: 5px;
    min-height: 20px;
    white-space: normal;
    word-break: break-word;
    line-height: 1.5;
}

.suggestion-meta {
    color: var(--subtle);
    font-size: 0.93em;
    display: flex;
    align-items: center;
    gap: 5px;
}

.related-confession {
    border-left: 4px solid var(--primary);
    position: relative;
    background: linear-gradient(to right, #f7f8ff, #ffffff);
    margin-bottom: 28px;
}

.parent-confession {
    border-left: 4px solid #34c759;
    background: linear-gradient(to right, #f2fbf5, #ffffff);
}

.relationship-badge {
    position: absolute;
    top: -12px;
    left: 20px;
    background: #5c6ac4;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(92,106,196,0.2);
    display: flex;
    align-items: center;
    gap: 6px;
}

.relationship-badge.is-reply {
    background: #8067dc;
}

.parent-confession .relationship-badge {
    background: #34c759;
}

.preview-content {
    font-size: 1.1em;
    line-height: 1.6;
    margin: 20px 0 14px 0;
    color: #444;
    white-space: pre-line;
}

.replies-section {
    margin-top: 40px;
    margin-bottom: 40px;
}

.replies-section h3 {
    margin-bottom: 22px;
    position: relative;
    display: inline-block;
}

.replies-section h3::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 40px;
    height: 3px;
    background: #8067dc;
    border-radius: 2px;
}

.reply-card {
    border-left: 4px solid #8067dc;
    background: linear-gradient(to right, #f5f4ff, #ffffff);
}

.is-reply {
    position: relative;
}

.is-reply::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 20px;
    width: 20px;
    height: 10px;
    background: var(--card-bg);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}

.read-link {
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s;
}

.read-link:hover {
    transform: translateX(3px);
}

/* ===== FOOTER ===== */
footer {
    background: linear-gradient(to right, #e7e9fc, #e2e6f9);
    color: #555;
    font-size: 0.98em;
    text-align: center;
    padding: 22px 0;
    border-top: 1px solid #d3d3f3;
    margin-top: auto;
    flex-shrink: 0;
    box-shadow: 0 -2px 10px rgba(92,106,196,0.04);
}

/* ===== RESPONSIVE STYLES ===== */
@media (max-width: 600px) {
    .container {
        max-width: 98vw;
        padding: 20px 3vw;
    }
    header {
        padding: 16px 0;
    }
    header h1 {
        font-size: 1.3em;
    }
    nav a {
        margin-left: 10px;
        font-size: .97em;
        padding: 8px 10px;
    }
    .card {
        padding: 18px 16px 12px;
    }
    form {
        padding: 20px 16px;
    }
    
    .suggestion-row {
        flex-direction: column;
        gap: 20px;
    }
    .suggestion-block {
        max-width: 100%;
    }
    
    .share-card {
        flex-direction: column;
        align-items: stretch;
        padding: 14px 12px;
        gap: 10px;
    }
    .share-link-info {
        max-width: 100%;
    }
    .share-url {
        max-width: 80vw;
        font-size: 0.95em;
    }
    .share-copy-btn {
        align-self: flex-end;
    }
}

.popular-card {
    border-left: 4px solid #ff9500;
    background: linear-gradient(to right, #fff9f0, #ffffff);
}

.recent-card {
    border-left: 4px solid #34c759;
    background: linear-gradient(to right, #f2fbf5, #ffffff);
}

.feature-badge {
    position: absolute;
    top: -12px;
    right: 20px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
}

.most-viewed {
    background: linear-gradient(to right, #ff9500, #ff7a00);
}

.most-recent {
    background: linear-gradient(to right, #34c759, #2ca745);
}

/* Add positioning context to cards */
.card {
    position: relative;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card, form, .comment-card, .suggestion-card {
    animation: fadeIn 0.3s ease-out forwards;
}

/* ===== CUSTOM SCROLLBAR (works in most browsers) ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: #c0c6e4;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}


.policy-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid var(--primary-light);
}

.policy-section {
    margin-bottom: 30px;
}

.policy-section h3 {
    color: var(--primary);
    margin-bottom: 15px;
    border-bottom: 1px solid var(--primary-light);
    padding-bottom: 8px;
}

.policy-section p, .policy-section ul {
    margin-bottom: 15px;
    line-height: 1.6;
}

.policy-section ul {
    padding-left: 25px;
}

.policy-section li {
    margin-bottom: 8px;
}

.system-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85em;
    color: var(--subtle);
    margin-bottom: 20px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    border: 1px solid var(--primary-light);
}


@media (max-width: 600px) {
    .policy-container {
        padding: 20px 15px;
    }
}

.subscription-modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

/* Modal Content */
.subscription-content {
    background: linear-gradient(to bottom right, #ffffff, #f8f9ff);
    margin: 15px;
    padding: 30px;
    border: 1px solid #d3d3f3;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(92,106,196,0.2);
    max-width: 500px;
    width: 100%;
    position: relative;
    animation: slideIn 0.4s;
}

/* Close Button */
.subscription-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.15s;
}

.subscription-close:hover {
    color: #5c6ac4;
}

/* Form Styling */
#subscription-form {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#subscription-form input[type="email"] {
    padding: 14px;
    border-radius: 8px;
    border: 1px solid #d3d3f3;
    font-size: 1.05em;
    transition: border 0.2s, box-shadow 0.2s;
}

#subscription-form input[type="email"]:focus {
    outline: none;
    border-color: #5c6ac4;
    box-shadow: 0 0 0 3px rgba(92,106,196,0.1);
}

#subscription-form button {
    background: linear-gradient(to right, #5c6ac4, #4a5ab9);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 28px;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
}

#subscription-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(92,106,196,0.2);
}

.subscription-privacy {
    font-size: 0.85em;
    color: #888;
    text-align: center;
    margin-top: 10px;
}

.subscription-privacy a {
    color: #5c6ac4;
    text-decoration: none;
}

.subscription-privacy a:hover {
    text-decoration: underline;
}

/* Thank You Message */
.subscription-thanks {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

.subscription-thanks-content {
    background: linear-gradient(to bottom right, #f8fff9, #f0ffef);
    border: 1px solid #34c759;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(52,199,89,0.2);
    max-width: 500px;
    width: 100%;
    text-align: center;
    position: relative;
    animation: slideIn 0.4s;
}

.subscription-thanks h3 {
    color: #34c759;
    margin-bottom: 15px;
}

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

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

@media (max-width: 600px) {
    .subscription-content,
    .subscription-thanks-content {
        padding: 20px;
        margin: 10px;
    }
}
