/* DigitalMe Common Styles
 * Shared reset, typography, CSS variables, and utility classes.
 * Theme-specific variables are scoped to .theme-owner / .theme-visitor
 * on <body>, set by layout templates.
 */

/* === Reset === */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* === Shared CSS Variables === */
:root {
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --bg-white: #ffffff;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --warning: #f59e0b;
    --success: #10b981;
    --info: #3b82f6;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* === Theme: Owner (Green) === */
.theme-owner {
    --primary: #10b981;
    --primary-dark: #059669;
    --primary-light: #d1fae5;
    --primary-bg: #f0fdf4;
    --bg-light: #f9fafb;
}

/* === Theme: Visitor (Blue) === */
.theme-visitor {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #dbeafe;
    --primary-bg: #eff6ff;
    --bg-light: #f8fafc;
}

/* === Base Typography === */
body {
    font-family: var(--font-family);
    background: var(--bg-light);
    color: var(--text-dark);
    min-height: 100vh;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
    text-decoration: none;
}

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

.btn-danger:hover {
    background: var(--danger-dark);
    color: white;
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dark);
}

.btn-outline:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--text-dark);
    text-decoration: none;
}

/* === Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* === Flash Messages === */
.flash-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 420px;
}

.flash-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: flash-slide-in 0.3s ease-out;
}

.flash-message.flash-success {
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.flash-message.flash-error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.flash-message.flash-warning {
    background: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
}

.flash-message.flash-info {
    background: #dbeafe;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.flash-dismiss {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.6;
    padding: 0 4px;
    color: inherit;
}

.flash-dismiss:hover {
    opacity: 1;
}

@keyframes flash-slide-in {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* === HTMX Indicator === */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-block;
}

/* === Utilities === */
.hidden {
    display: none !important;
}

.text-muted {
    color: var(--text-muted);
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

/* === Markdown Content Styling === */
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
    margin-top: 1.2em;
    margin-bottom: 0.4em;
}

.markdown-content h2 { font-size: 1.3rem; }
.markdown-content h3 { font-size: 1.1rem; }
.markdown-content h4 { font-size: 1rem; }

.markdown-content p {
    margin-bottom: 0.8em;
}

.markdown-content ul,
.markdown-content ol {
    margin-left: 1.5em;
    margin-bottom: 0.8em;
}

.markdown-content li {
    margin-bottom: 0.3em;
}

.markdown-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.87em;
}

.markdown-content pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1em;
}

.markdown-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.markdown-content strong {
    font-weight: 600;
}

.markdown-content blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 16px;
    color: var(--text-light);
    margin-bottom: 0.8em;
}
