/* 매일유틸 Common Styles - Extracted from all tool pages */

/* === CSS Variables (shared across all pages) === */
:root {
    --accent-color: #6366F1;
    --accent-light: #EEF2FF;
    --accent-hover: #4F46E5;
    --primary-color: #1a1a1a;
    --secondary-color: #666666;
    --success-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --bg-primary: #FAFAFA;
    --bg-surface: #FFFFFF;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #E8E8E8;
    --border-hover: #d0d0d0;
    --accent-color-alt: #E8E8E8;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 12px 0 rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 8px 24px 0 rgba(0, 0, 0, 0.08);
}

/* Dark mode */
body.dark-mode {
    --bg-primary: #0A0A0A;
    --bg-surface: #141414;
    --text-primary: #F5F5F5;
    --text-secondary: #A0A0A0;
    --text-muted: #666666;
    --border-color: #2A2A2A;
    --border-hover: #3A3A3A;
    --primary-color: #F5F5F5;
    --accent-color-alt: #2A2A2A;
    --accent-light: #1E1B4B;
}

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

/* === Body === */
body {
    font-family: 'Noto Sans KR', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text-primary);
    line-height: 1.6;
    letter-spacing: -0.01em;
    transition: background 0.3s ease, color 0.3s ease;
}

/* === Header (styles.css version - used by pages with <header>) === */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(250, 250, 250, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

body.dark-mode header {
    background: rgba(10, 10, 10, 0.95);
}

header.scrolled {
    border-bottom-color: var(--border-color);
}

.header-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.logo:hover {
    opacity: 0.7;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-toggle {
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    position: relative;
}

.theme-toggle:hover {
    background: var(--accent-color-alt);
    color: var(--text-primary);
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
}

.theme-toggle .sun {
    position: absolute;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

body.dark-mode .theme-toggle .sun {
    opacity: 1;
    transform: scale(1);
}

.theme-toggle .moon {
    position: absolute;
    opacity: 1;
    transform: scale(1);
    transition: all 0.3s ease;
}

body.dark-mode .theme-toggle .moon {
    opacity: 0;
    transform: scale(0.8);
}

/* === Main Content (styles.css version) === */
main {
    flex: 1;
    max-width: 1000px;
    margin: 0 auto;
    padding: 4rem 2rem 6rem;
    width: 100%;
}

.page-header {
    margin-bottom: 3rem;
}

.page-title {
    font-size: 2.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: var(--text-primary);
}

.page-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.7;
    font-weight: 300;
}

/* === Tool Container (styles.css version) === */
.tool-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    transition: all 0.2s ease;
}

.tool-container:hover {
    border-color: var(--border-hover);
}

/* === Buttons (styles.css version) === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.938rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    border: none;
}

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

.btn-primary:hover {
    opacity: 0.8;
}

.btn-secondary {
    background: var(--accent-color-alt);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-hover);
}

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

.btn-outline:hover {
    border-color: var(--border-hover);
    background: var(--accent-color-alt);
}

/* === Form Elements (styles.css version) === */
input,
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
    margin-bottom: 1rem;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--border-hover);
    box-shadow: 0 0 0 3px var(--accent-color-alt);
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* === Results Section (styles.css version) === */
.result-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.result-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* === Footer Actions === */
.footer-actions {
    margin-top: 3rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.938rem;
    transition: all 0.2s ease;
}

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

/* === Advertisement === */
.ad-space {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin: 3rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    transition: all 0.2s ease;
}

.ad-space:hover {
    border-color: var(--border-hover);
}

/* === Shared Layout: Container (used by inline-style pages) === */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* === Shared Card === */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

/* === Shared Input Group === */
.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    transition: border 0.2s;
    margin-bottom: 0;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.input-row {
    display: flex;
    gap: 0.75rem;
}

.input-row .input-group {
    flex: 1;
}

/* === Shared Full-width Button === */
.btn-full {
    width: 100%;
    padding: 0.85rem;
    font-size: 1rem;
    font-weight: 600;
    background: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-full:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* === Shared Result Section === */
.result-section-inline {
    display: none;
}

.result-section-inline.show {
    display: block;
}

.result-main {
    text-align: center;
    padding: 2rem 1.5rem;
    margin-bottom: 1rem;
    background: var(--accent-light);
    border-radius: 12px;
}

.result-main .rm-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.result-main .rm-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-color);
    line-height: 1.2;
}

.result-main .rm-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* === Deduction list (salary/loan pages) === */
.deduction-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.deduction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.deduction-item .di-label {
    color: var(--text-secondary);
}

.deduction-item .di-value {
    font-weight: 600;
}

.deduction-item.total {
    background: var(--accent-light);
    border-color: var(--accent-color);
}

.deduction-item.total .di-label {
    color: var(--accent-color);
    font-weight: 600;
}

.deduction-item.total .di-value {
    color: var(--accent-color);
}

/* === Ad section === */
.ad-section {
    margin: 2rem 0;
}

.ad-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 0.5rem;
}

/* === Toast Notification === */
.toast-container {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    pointer-events: none;
}

.toast {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: auto;
    max-width: 90vw;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

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

.toast-error {
    background: var(--danger-color);
}

.toast-success {
    background: var(--success-color);
}

.toast-info {
    background: var(--accent-color);
}

/* === Responsive === */
@media (max-width: 768px) {
    .header-container {
        padding: 1rem 1.5rem;
    }

    main {
        padding: 2rem 1.5rem 4rem;
    }

    .page-title {
        font-size: 1.75rem;
    }

    .page-description {
        font-size: 1rem;
    }

    .tool-container {
        padding: 1.5rem;
    }

    .result-value {
        font-size: 1.25rem;
    }

    .container {
        padding: 1.25rem;
    }

    .result-main .rm-value {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .input-row {
        flex-direction: column;
        gap: 0;
    }

    .container {
        padding: 1.25rem;
    }
}

/* Focus visible for keyboard accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--ac, #6366F1);
    outline-offset: 2px;
}
