:root {
    /* Colors */
    --primary: hsl(230, 85%, 60%);
    --primary-hover: hsl(230, 85%, 50%);
    --secondary: hsl(170, 80%, 50%);
    --accent: hsl(330, 80%, 60%);

    --bg-dark: hsl(220, 30%, 8%);
    --bg-card: hsla(220, 30%, 14%, 0.6);
    --bg-glass: hsla(220, 30%, 14%, 0.4);

    --text-main: hsl(0, 0%, 100%);
    --text-muted: hsla(220, 20%, 80%, 0.8);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary), var(--secondary));
    --gradient-logo: linear-gradient(135deg, #4ade80, #3b82f6);
    --gradient-glow: radial-gradient(circle at center, var(--primary), transparent 70%);

    /* Spacing */
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 2rem;
    --space-xl: 4rem;

    /* Borders & Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --border-glass: 1px solid hsla(0, 0%, 100%, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Noto Sans KR', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Outfit', 'Noto Sans KR', sans-serif;
    font-weight: 700;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s ease;
}

ul {
    list-style: none;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px hsla(230, 85%, 60%, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px hsla(230, 85%, 60%, 0.6);
}

.btn-glass {
    background: var(--bg-glass);
    border: var(--border-glass);
    backdrop-filter: blur(10px);
    color: var(--text-main);
}

.btn-glass:hover {
    background: hsla(220, 30%, 20%, 0.6);
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: var(--border-glass);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: transform 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
    border-color: hsla(0, 0%, 100%, 0.2);
}

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: var(--space-md) 0;
    background: hsla(220, 30%, 8%, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid hsla(0, 0%, 100%, 0.05);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Logo - Strict Alignment System */
.logo {
    display: inline-flex;
    flex-direction: column;
    /* Fallback */
    text-decoration: none;
    cursor: pointer;
}

.logo-grid {
    display: grid;
    grid-template-columns: auto auto;
    /* Allow natural width, but maybe align via justify? */
    /* To align H and 합 strictly, we need the split point to be the anchor. 
       Best way: Two equal width columns meeting in center? No 'Safe' != 'HappE'.
       Text-align approach:
    */
    grid-template-columns: 1fr 1fr;
    /* Equal width halves if wrapper is centered? */
    /* Let's try flexible columns but aligned to center seam. */
    align-items: baseline;
    column-gap: 0;
}

.logo-row-en {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -1px;
    /* Removed display: contents */
}

/* Row 1 Cells */
.logo-en-left {
    color: #fff;
    text-align: right;
    grid-column: 1;
    grid-row: 1;
    display: block;
}

.logo-en-right {
    background: var(--gradient-logo);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: left;
    grid-column: 2;
    grid-row: 1;
    display: block;
}

.logo-row-kr {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Row 2 Cells */
.logo-kr-left {
    color: var(--text-muted);
    /* Gray */
    text-align: right;
    grid-column: 1;
    grid-row: 2;
    padding-right: 0px;
    display: block;
    /* Adjust proximity to seam */
    /* To visually pull '세이프' bit left if needed? No, right align pulls it to seam. */
}

.logo-kr-right {
    background: var(--gradient-logo);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: left;
    grid-column: 2;
    grid-row: 2;
    padding-left: 0px;
    display: block;
}

nav ul {
    display: flex;
    gap: var(--space-lg);
}

nav a {
    color: var(--text-muted);
    font-size: 0.95rem;
}

nav a:hover {
    color: var(--text-main);
}

/* Hero Section */
.hero {
    position: relative;
    padding: 180px 0 100px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    overflow: hidden;
}

/* Background Glow Effects */
.glow-bg {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary) 0%, transparent 60%);
    opacity: 0.15;
    filter: blur(80px);
    top: -100px;
    left: -100px;
    z-index: -1;
    animation: float 10s infinite ease-in-out;
}

.glow-bg-2 {
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--secondary) 0%, transparent 60%);
    opacity: 0.1;
    filter: blur(80px);
    bottom: 0;
    right: -100px;
    z-index: -1;
    animation: float 12s infinite ease-in-out reverse;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(30px, 50px);
    }
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
    align-items: center;
}

.hero-text h1 {
    font-size: 4rem;
    line-height: 1.4;
    letter-spacing: -0.03em;
    margin-bottom: var(--space-lg);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.hero-text .highlight {
    color: var(--secondary);
    position: relative;
    display: inline-block;
    /* Removed gradient and drop-shadow as per request to revert color style */
}

.hero-text p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: var(--space-lg);
    max-width: 500px;
}

.hero-cta {
    display: flex;
    gap: var(--space-md);
}

.hero-visual {
    position: relative;
}

.hero-card-mockup {
    background: linear-gradient(160deg, hsla(0, 0%, 100%, 0.1), hsla(0, 0%, 100%, 0.05));
    border: 1px solid hsla(0, 0%, 100%, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    backdrop-filter: blur(20px);
    transform: rotateY(-10deg) rotateX(5deg);
    perspective: 1000px;
    box-shadow: 20px 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
}

.mockup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid hsla(0, 0%, 100%, 0.1);
}

.status-badge {
    padding: 0.3rem 0.8rem;
    background: hsla(170, 80%, 50%, 0.2);
    color: var(--secondary);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Features Section */
.features {
    padding: 100px 0;
    position: relative;
}

.section-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: var(--space-sm);
}

.section-header p {
    color: var(--text-muted);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: var(--space-md);
    background: var(--bg-glass);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--primary);
}

/* Footer */
footer {
    padding: var(--space-xl) 0;
    background: hsla(220, 30%, 6%, 0.95);
    border-top: 1px solid hsla(0, 0%, 100%, 0.05);
    margin-top: 100px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
}

.footer-brand h3 {
    margin-bottom: var(--space-md);
    font-size: 1.5rem;
}

.footer-brand p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-links h4 {
    margin-bottom: var(--space-md);
    color: var(--text-main);
}

.footer-links ul li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: var(--secondary);
}

@media (max-width: 768px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-cta {
        justify-content: center;
    }

    .hero-text h1 {
        font-size: 2.5rem;
    }

    .hero-card-mockup {
        margin-top: var(--space-lg);
        transform: none;
    }

    .hero-text p {
        margin: 0 auto var(--space-lg);
    }
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-input {
    width: 100%;
    padding: 1rem;
    background: hsla(220, 30%, 14%, 0.4);
    border: 1px solid hsla(0, 0%, 100%, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: hsla(220, 30%, 14%, 0.8);
    box-shadow: 0 0 0 3px hsla(230, 85%, 60%, 0.1);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
}

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    background: radial-gradient(circle at top right, hsla(230, 85%, 60%, 0.1), transparent 40%),
        radial-gradient(circle at bottom left, hsla(170, 80%, 50%, 0.05), transparent 40%);
}

.auth-box {
    width: 100%;
    max-width: 450px;
    text-align: center;
}

/* --- Dashboard Layout --- */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: hsla(220, 30%, 8%, 0.95);
    border-right: 1px solid hsla(0, 0%, 100%, 0.05);
    padding: var(--space-lg) var(--space-md);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar .logo {
    margin-bottom: 40px;
    padding-left: 10px;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: 0.3s;
    cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
    background: hsla(220, 30%, 14%, 0.6);
    color: var(--text-main);
    font-weight: 500;
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    /* Width of sidebar */
    padding: var(--space-lg);
    background: var(--bg-dark);
    /* Fallback */
    background: radial-gradient(circle at top right, hsla(220, 30%, 15%, 0.3), transparent 50%);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-lg);
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Mobile Responsive Updates --- */
@media (max-width: 768px) {

    /* Layout Reset */
    .dashboard-layout {
        flex-direction: column;
        padding-bottom: 70px;
        /* Space for bottom nav */
    }

    /* Sidebar -> Bottom Nav */
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        bottom: 0;
        left: 0;
        top: auto;
        border-right: none;
        border-top: 1px solid hsla(0, 0%, 100%, 0.1);
        padding: 10px 20px;
        flex-direction: row;
        justify-content: space-around;
        background: hsla(220, 30%, 8%, 0.98);
        z-index: 1000;
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
    }

    .sidebar .logo {
        display: none;
        /* Hide logo in bottom nav */
    }

    .nav-links {
        flex-direction: row;
        width: 100%;
        justify-content: space-between;
        gap: 0;
    }

    .nav-item {
        flex-direction: column;
        gap: 5px;
        font-size: 0.7rem;
        padding: 5px 10px;
        text-align: center;
        border-radius: 0;
    }

    .nav-item i {
        font-size: 1.2rem;
        margin-bottom: 2px;
    }

    /* Hide Logout on Mobile Nav to save space */
    .nav-item:last-child {
        display: none;
    }

    /* Main Content Adjustments */
    .main-content {
        margin-left: 0;
        padding: 20px;
        padding-bottom: 100px;
    }

    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .top-bar>div:last-child {
        width: 100%;
        justify-content: space-between;
    }

    /* Stack Grids */
    .dashboard-grid {
        display: flex;
        flex-direction: column;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    /* Agreements Page Mobile */
    .two-column-layout {
        grid-template-columns: 1fr;
    }

    .document-viewer {
        height: 500px;
        padding: 10px;
    }

    .paper-doc {
        padding: 20px;
        font-size: 0.9rem;
    }
}

.stat-card {
    background: var(--bg-card);
    border: var(--border-glass);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Chat UI */
.chat-container {
    background: var(--bg-card);
    border: var(--border-glass);
    border-radius: var(--radius-md);
    height: 600px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid hsla(0, 0%, 100%, 0.05);
    background: hsla(220, 30%, 12%, 0.8);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.message.received {
    align-self: flex-start;
    background: hsla(220, 30%, 20%, 0.8);
    color: var(--text-muted);
    border-bottom-left-radius: 2px;
}

.message.sent {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 2px;
}

.message-input-area {
    padding: 16px;
    background: hsla(220, 30%, 10%, 0.8);
    border-top: 1px solid hsla(0, 0%, 100%, 0.05);
    display: flex;
    gap: 10px;
}

.system-msg {
    align-self: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: hsla(0, 0%, 100%, 0.05);
    padding: 4px 12px;
    border-radius: 20px;
    margin: 10px 0;
}

/* --- Apology Letter Styling --- */

/* Stationery Styles */
.stationery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.style-option-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.style-option-card:hover {
    background: rgba(255, 255, 255, 0.1);
}

.style-option-card.selected {
    border-color: var(--secondary);
    background: rgba(74, 222, 128, 0.1);
}

.style-preview-box {
    width: 100%;
    height: 80px;
    margin-bottom: 10px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Background Variants */
.bg-basic {
    background-color: #ffffff;
}

.bg-sincere {
    background-color: #fcf8f2;
    background-image: url("data:image/svg+xml,%3Csvg width='6' height='6' viewBox='0 0 6 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%239C92AC' fill-opacity='0.1' fill-rule='evenodd'%3E%3Cpath d='M5 0h1L0 6V5zM6 5v1H5z'/%3E%3C/g%3E%3C/svg%3E");
}

.bg-formal {
    background-color: #ffffff;
    background-image: linear-gradient(#e5e5e5 1px, transparent 1px);
    background-size: 100% 2em;
}

.bg-emotional {
    background: linear-gradient(to bottom right, #e0eafc, #a8edea);
}


/* Font Variants */
.font-basic {
    font-family: 'Inter', sans-serif;
    /* Default */
}

.font-serif {
    font-family: 'Noto Serif KR', serif;
}

.font-hand {
    font-family: 'Nanum Pen Script', cursive;
}

/* Preview Modal */
.preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.preview-content {
    background: #fff;
    color: #333;
    width: 90%;
    max-width: 600px;
    height: 80vh;
    padding: 40px;
    border-radius: 8px;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #888;
}

.modal-close:hover {
    color: #333;
}

@keyframes swing {
    20% {
        transform: rotate(15deg);
    }

    40% {
        transform: rotate(-10deg);
    }

    60% {
        transform: rotate(5deg);
    }

    80% {
        transform: rotate(-5deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

/* Process Section */
.process-section {
    padding: 100px 0;
    background: radial-gradient(circle at center, hsla(230, 85%, 60%, 0.05), transparent 70%);
}

.process-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 50px;
}

.process-card {
    flex: 1;
    min-width: 220px;
    background: var(--bg-card);
    border: var(--border-glass);
    border-radius: var(--radius-md);
    padding: 30px 20px;
    text-align: center;
    position: relative;
    transition: transform 0.3s;
}

.process-card:hover {
    transform: translateY(-10px);
    border-color: rgba(255, 255, 255, 0.2);
}

.process-card.highlight-step {
    border: 1px solid var(--secondary);
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.1);
}

.step-number {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    padding: 5px 15px;
    border-radius: 20px;
}

.process-card.highlight-step .step-number {
    color: var(--secondary);
    border-color: var(--secondary);
}

.process-card .icon-box {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 20px;
    margin-top: 10px;
}

.process-card.highlight-step .icon-box {
    color: var(--secondary);
}

.process-card h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.process-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.process-arrow {
    color: rgba(255, 255, 255, 0.1);
    font-size: 1.5rem;
}

@media (max-width: 900px) {
    .process-steps {
        flex-direction: column;
        gap: 40px;
    }

    .process-arrow {
        transform: rotate(90deg);
    }
}