/* =============================================
   STITCH DESIGN SYSTEM - Global Styles
   ============================================= */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root {
    --stitch-blue: #2563eb;
    --stitch-blue-dark: #1d4ed8;
    --stitch-blue-light: #3b82f6;
    --stitch-bg: #f8fafc;
    --stitch-card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

/* Body */
.stitch-body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--stitch-bg);
    min-height: 100vh;
}

/* =============================================
   NAVIGATION
   ============================================= */
.stitch-nav {
    background-color: var(--stitch-blue);
    color: white;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.stitch-nav-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.stitch-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: white !important;
    text-decoration: none !important;
}

.stitch-logo-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.stitch-nav-menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.stitch-nav-link {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    color: rgba(255, 255, 255, 0.9) !important;
    text-decoration: none !important;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.stitch-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: white !important;
}

.stitch-nav-dropdown {
    cursor: pointer;
}

.stitch-chevron {
    width: 0.875rem;
    height: 0.875rem;
}

.stitch-dropdown-menu {
    border: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
    min-width: 160px;
    margin-top: 0.5rem;
}

.stitch-dropdown-menu .dropdown-item {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    color: #374151;
}

.stitch-dropdown-menu .dropdown-item:hover {
    background-color: #f9fafb;
    color: var(--stitch-blue);
}

.stitch-nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stitch-nav-action {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: rgba(255, 255, 255, 0.9) !important;
    text-decoration: none !important;
    font-size: 0.875rem;
    transition: color 0.15s;
}

.stitch-nav-action:hover {
    color: white !important;
}

.stitch-logout-btn {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}

.stitch-action-icon {
    width: 1rem;
    height: 1rem;
}

/* =============================================
   LAYOUT
   ============================================= */
.stitch-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.stitch-main {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
}

/* =============================================
   PAGE HEADER (Stitch Style)
   ============================================= */
.stitch-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.stitch-page-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stitch-page-icon {
    padding: 0.5rem;
    background-color: #f1f5f9;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-size: 1.25rem;
}

.stitch-page-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

/* =============================================
   CARDS (Stitch Style)
   ============================================= */
.card {
    border: 1px solid #e2e8f0;
    box-shadow: var(--stitch-card-shadow);
    border-radius: 0.5rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.25rem;
}

.card-header h5,
.card-header h6 {
    color: #374151;
    font-weight: 600;
}

/* =============================================
   KPI CARDS (Dashboard)
   ============================================= */
.stitch-kpi-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .stitch-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .stitch-kpi-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stitch-kpi-card {
    border-radius: 0.5rem;
    padding: 1.25rem;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--stitch-card-shadow);
}

.stitch-kpi-card.blue  { background-color: #3b82f6; }
.stitch-kpi-card.green { background-color: #059669; }
.stitch-kpi-card.amber { background-color: #f59e0b; }
.stitch-kpi-card.cyan  { background-color: #06b6d4; }

.stitch-kpi-label {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.stitch-kpi-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.stitch-kpi-icon {
    opacity: 0.35;
    font-size: 3rem;
    line-height: 1;
    display: flex;
    align-items: center;
}

/* =============================================
   SECTION GRID (Dashboard)
   ============================================= */
.stitch-section-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 1024px) {
    .stitch-section-grid {
        grid-template-columns: 2fr 1fr;
    }
}

.stitch-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: var(--stitch-card-shadow);
}

.stitch-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stitch-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #374151;
    font-size: 0.9375rem;
    margin: 0;
}

.stitch-card-body {
    padding: 1.25rem;
}

.stitch-btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--stitch-blue);
    border: 1px solid var(--stitch-blue);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    background: transparent;
    text-decoration: none;
    transition: background-color 0.15s;
    white-space: nowrap;
}

.stitch-btn-outline:hover {
    background-color: #eff6ff;
    color: var(--stitch-blue-dark);
    text-decoration: none;
}

.stitch-btn-outline-sm {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--stitch-blue);
    border: 1px solid #bfdbfe;
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    background: transparent;
    text-decoration: none;
    transition: background-color 0.15s;
    white-space: nowrap;
}

.stitch-btn-outline-sm:hover {
    background-color: #eff6ff;
    color: var(--stitch-blue-dark);
    text-decoration: none;
}

/* =============================================
   TABLES
   ============================================= */
.table th {
    font-weight: 600;
    white-space: nowrap;
    color: #475569;
    font-size: 0.875rem;
}

.table-hover tbody tr:hover {
    background-color: #f8fafc;
}

.table thead.table-light th {
    background-color: #f8fafc;
    border-color: #e2e8f0;
}

/* =============================================
   BUTTONS (Stitch Style)
   ============================================= */
.btn {
    font-weight: 500;
}

.btn-primary {
    background-color: var(--stitch-blue);
    border-color: var(--stitch-blue);
}

.btn-primary:hover {
    background-color: var(--stitch-blue-dark);
    border-color: var(--stitch-blue-dark);
}

.btn-outline-primary {
    color: var(--stitch-blue);
    border-color: var(--stitch-blue);
}

.btn-outline-primary:hover {
    background-color: var(--stitch-blue);
    border-color: var(--stitch-blue);
}

.stitch-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--stitch-blue);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s;
    font-family: inherit;
}

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

/* =============================================
   BADGES
   ============================================= */
.badge {
    font-weight: 500;
}

/* =============================================
   FORMS
   ============================================= */
.form-control:focus,
.form-select:focus {
    border-color: var(--stitch-blue);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}

/* =============================================
   PAGINATION
   ============================================= */
.pagination .page-link {
    border: 1px solid #e2e8f0;
    margin: 0 0.125rem;
    border-radius: 0.375rem;
    color: #374151;
    font-size: 0.875rem;
}

.pagination .page-item.active .page-link {
    background-color: var(--stitch-blue);
    border-color: var(--stitch-blue);
}

.pagination .page-link:hover {
    background-color: #f1f5f9;
    color: var(--stitch-blue);
}

/* =============================================
   ALERTS
   ============================================= */
.alert {
    border: none;
    border-radius: 0.5rem;
}

/* =============================================
   MODAL (Stitch Style)
   ============================================= */
.modal-content {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.25rem;
}

.modal-footer {
    border-top: 1px solid #e2e8f0;
    padding: 0.875rem 1.25rem;
}

/* =============================================
   FOOTER (Stitch Style)
   ============================================= */
.stitch-footer {
    background-color: #1e293b;
    color: #94a3b8;
    padding: 1.25rem 0;
    margin-top: 2rem;
}

.stitch-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.stitch-footer-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #e2e8f0;
    font-weight: 600;
    font-size: 0.9375rem;
}

.stitch-footer-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: #60a5fa;
}

.stitch-footer-title {
    color: #e2e8f0;
}

.stitch-footer-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.8125rem;
}

.stitch-footer-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.stitch-footer-divider {
    color: #475569;
}

.stitch-footer-link {
    color: #60a5fa;
    text-decoration: none;
    transition: color 0.15s;
}

.stitch-footer-link:hover {
    color: #93c5fd;
}

.stitch-footer-copy {
    font-size: 0.8rem;
    color: #475569;
}

@media (max-width: 768px) {
    .stitch-footer-inner {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .stitch-footer-info {
        justify-content: center;
    }
}

/* =============================================
   AUTH PAGES (Stitch Style)
   ============================================= */
.stitch-auth-body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 50%, #1e40af 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.stitch-auth-card {
    background: white;
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.stitch-auth-logo {
    text-align: center;
    margin-bottom: 1.75rem;
}

.stitch-auth-logo-icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 0.75rem;
    color: var(--stitch-blue);
}

.stitch-auth-logo h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.stitch-auth-logo p {
    color: #64748b;
    font-size: 0.875rem;
    margin: 0;
}

/* Wide auth card for register */
.stitch-auth-card.wide {
    max-width: 480px;
}

/* =============================================
   LOADING
   ============================================= */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* =============================================
   TRANSITIONS
   ============================================= */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

/* =============================================
   POST CONTENT
   ============================================= */
.post-content h1, .post-content h2, .post-content h3,
.post-content h4, .post-content h5, .post-content h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.post-content p     { margin-bottom: 1rem; }

.post-content pre {
    background-color: #f1f5f9;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
}

.post-content code {
    background-color: #f1f5f9;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

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

.post-content blockquote {
    border-left: 4px solid #e2e8f0;
    padding-left: 1rem;
    margin-left: 0;
    color: #64748b;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
}

.post-content ul, .post-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

/* =============================================
   POST EDITOR
   ============================================= */
.ck-editor__editable { min-height: 400px; }

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-item .file-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-progress { width: 100px; }

.tag-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35em 0.65em;
    font-size: 0.875em;
    background-color: #e2e8f0;
    border-radius: 0.375rem;
    color: #374151;
}

.tag-badge .btn-close {
    width: 0.5em;
    height: 0.5em;
    margin-left: 0.5em;
}

/* =============================================
   SCHEDULE (FullCalendar)
   ============================================= */
#calendar { max-width: 100%; margin: 0 auto; }
.fc-event  { cursor: pointer; }

.color-option {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    display: inline-block;
    margin-right: 5px;
    transition: transform 0.15s;
}

.color-option.selected { border-color: #1e293b; }
.color-option:hover     { transform: scale(1.1); }

/* =============================================
   SETTINGS
   ============================================= */
.layout-option {
    cursor: pointer;
    transition: border-color 0.15s;
}

.layout-option:hover { border-color: var(--stitch-blue) !important; }

.layout-option.border-primary { border-width: 2px !important; }

.color-preset {
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #e2e8f0;
}

.color-preset:hover { transform: scale(1.1); }

#widgetList .widget-item { transition: background-color 0.15s; }
/* legacy list-group-item support */
#widgetList .list-group-item { transition: background-color 0.15s; }
#widgetList .list-group-item:hover { background-color: #f8fafc; }
#widgetList .list-group-item.dragging {
    opacity: 0.5;
    background-color: #eff6ff;
}

.drag-handle:hover, .drag-handle i:hover { color: var(--stitch-blue) !important; }

/* =============================================
   CATEGORY
   ============================================= */
.category-item.sortable-ghost {
    opacity: 0.4;
    background: #f8fafc;
}

.category-item.sortable-chosen { background: #e2e8f0; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    .stitch-nav-menu { display: none; }

    .stitch-nav-left { gap: 1rem; }

    .table-responsive { font-size: 0.875rem; }

    .btn-group-sm .btn { padding: 0.25rem 0.4rem; }

    .stitch-kpi-value { font-size: 1.75rem; }
}
