:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --doc-bg: #ffffff;
    --doc-text: #1a1a1a;
}

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

body {
    font-family: 'Inter', 'Noto Sans KR', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    text-align: center;
    animation: fadeInDown 0.8s ease-out;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #818cf8, #c084fc);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2rem;
    align-items: start;
}

/* Glassmorphism Card */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeInLeft 0.8s ease-out;
}

.glass-card h2 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    font-weight: 600;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.input-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.primary-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

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

.btn-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.btn-group .primary-btn {
    flex: 1;
    margin-top: 0;
    font-size: 0.95rem;
    padding: 0.85rem;
}

.btn-png {
    background: #059669;
}

.btn-png:hover {
    background: #047857;
    box-shadow: 0 10px 15px -3px rgba(5, 150, 105, 0.4);
}

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

/* Document Preview */
.preview-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: fadeInRight 0.8s ease-out;
    width: 100%;
    overflow-x: auto; /* Side cutoff prevention */
    padding-bottom: 1rem;
}

.preview-controls {
    text-align: right;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.preview-wrapper {
    width: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    background: rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 1rem 0;
}

.document-page {
    background: var(--doc-bg);
    color: var(--doc-text);
    width: 794px; /* A4 width at 96dpi */
    height: 1123px; /* A4 height at 96dpi */
    padding: 60px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-radius: 2px;
    transform-origin: top center;
    position: relative;
    flex-shrink: 0;
}

.doc-header {
    text-align: center;
    margin-bottom: 3rem;
    border-bottom: 2px solid #333;
    padding-bottom: 1rem;
}

.doc-header h1 {
    font-size: 2rem;
    font-weight: 700;
}

.doc-section {
    margin-bottom: 2.5rem;
}

.doc-section h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    border-left: 4px solid #333;
    padding-left: 0.8rem;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
}

.info-table td {
    padding: 0.8rem 0;
    font-size: 1.1rem;
}

.info-table td.label {
    width: 40%;
    font-weight: 600;
}

.doc-confirmation {
    margin-top: 4rem;
    text-align: center;
    line-height: 1.8;
    font-size: 1.1rem;
    font-weight: 500;
}

.doc-date {
    margin-top: 4rem;
    text-align: center;
    font-size: 1.1rem;
}

.doc-footer {
    margin-top: 4rem;
    text-align: right;
    font-size: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.signature-line {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 5px;
}

.regular-name {
    min-width: 60px;
    text-align: left;
    margin-right: 15px;
    font-weight: 500;
}

.stamp-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 160px;
    height: 40px;
}

.stamp-label {
    color: #999;
    font-size: 0.8rem;
    z-index: 1;
    white-space: nowrap;
}

.signature-font {
    position: absolute;
    font-family: 'Nanum Pen Script', cursive;
    font-size: 2.8rem; /* 크기를 더 키움 */
    color: rgba(26, 26, 26, 0.85); /* 약간의 투명도로 겹침 효과 */
    z-index: 2;
    transform: rotate(-12deg); /* 회전 각도 조정 */
    white-space: nowrap;
    pointer-events: none;
}

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 1.2rem;
    height: 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 1fr;
        max-width: 800px;
        margin: 0 auto;
    }
}

@media (max-width: 640px) {
    body {
        padding: 1rem 0.5rem;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .glass-card {
        padding: 1.2rem;
        border-radius: 16px;
    }
}

/* Scaling will be handled by JavaScript for perfect fit */
