:root {
    --bg-dark: #0f172a;
    --sidebar-bg: #1e293b;
    --card-bg: rgba(30, 41, 59, 0.7);
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --glass: rgba(255, 255, 255, 0.05);

    --purple: #a855f7;
    --blue: #3b82f6;
    --green: #22c55e;
    --orange: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body.dark-theme {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2.5rem;
    font-family: 'Outfit', sans-serif;
}

.logo i {
    color: var(--accent);
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    min-height: 0;
    /* Critical for flex scrolling */
    margin-bottom: 1rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.2rem;
    border-radius: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.nav-item i {
    width: 20px;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.nav-item span {
    font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
    background-color: var(--glass);
    color: var(--text-main);
}

.nav-item.active {
    background-color: var(--accent);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.sidebar-footer {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    /* Prevent shrinking */
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.details .name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
}

.details .role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
}

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.search-bar {
    position: relative;
    width: 400px;
}

.search-bar i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-bar input {
    width: 100%;
    background: var(--glass);
    border: 1px solid var(--border);
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border-radius: 1rem;
    color: var(--text-main);
    outline: none;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Form Controls */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-control {
    width: 100%;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.8rem 1rem;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Fix for Select dropdown visibility */
select.form-control {
    cursor: pointer;
}

select.form-control option {
    background-color: var(--sidebar-bg);
    /* Dark background for options */
    color: var(--text-main);
    padding: 10px;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.notifications {
    position: relative;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--orange);
    color: white;
    font-size: 0.65rem;
    padding: 2px 5px;
    border-radius: 10px;
}

/* Dashboard Header */
.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 2.2rem;
    font-family: 'Outfit', sans-serif;
    margin-bottom: 0.5rem;
}

.highlight {
    color: var(--accent);
}

.dashboard-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

/* Post Content Images */
.post-content img {
    max-width: 600px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px auto;
    display: block;
}

/* Specific fix for centered images wrapper */
.post-content div[style*="text-align:center"] img {
    margin: 0 auto;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.purple {
    background: rgba(168, 85, 247, 0.15);
    color: var(--purple);
}

.stat-icon.blue {
    background: rgba(59, 130, 246, 0.15);
    color: var(--blue);
}

.stat-icon.green {
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
}

.stat-icon.orange {
    background: rgba(245, 158, 11, 0.15);
    color: var(--orange);
}

.stat-info .label {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.stat-info .value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Content Rows */
.content-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    padding: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h2 {
    font-size: 1.25rem;
    font-family: 'Outfit', sans-serif;
}

.view-all {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
}

/* Table */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.empty-row td {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Account List */
.account-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.account-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--glass);
    padding: 1rem;
    border-radius: 0.75rem;
}

.acc-icon {
    font-size: 1.5rem;
}

.acc-details {
    flex: 1;
}

.acc-email {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
}

.acc-status {
    font-size: 0.75rem;
}

.acc-status.active {
    color: var(--green);
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--accent);
    color: white;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    transform: translateY(150%);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.modal-header {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.preview-body {
    flex: 1;
    overflow-y: auto;
    background: white;
    color: #333;
    padding: 2rem;
    border-radius: 0.5rem;
    line-height: 1.6;
}

.preview-body h1,
.preview-body h2,
.preview-body h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: #000;
}

.preview-body p {
    margin-bottom: 1rem;
}

.preview-body ul,
.preview-body ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

/* Utilities */
.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.flex {
    display: flex;
}

.gap-2 {
    gap: 0.5rem;
}

.w-full {
    width: 100%;
}

.text-muted {
    color: var(--text-muted);
}

/* Status Badges */
.status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.published {
    background: rgba(46, 213, 115, 0.2);
    color: #2ed573;
}

.status-badge.draft {
    background: rgba(255, 165, 2, 0.2);
    color: #ffa502;
}

/* Dashboard Specific */
.post-title-cell {
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.text-xs.text-muted {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Logout Button in Sidebar */
.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-color, #fff);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
    margin-top: 10px;
}

.btn-logout:hover {
    background-color: rgba(255, 68, 68, 0.2);
    color: #ff4444;
}

/* ========================================
   MOBILE RESPONSIVE STYLES (Cleaned & Optimized)
   ======================================== */

/* Mobile Bottom Navigation (Visible only on mobile) */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 65px;
    background: var(--sidebar-bg);
    border-top: 1px solid var(--border);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
}

.mobile-bottom-nav .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    gap: 4px;
}

.mobile-bottom-nav .nav-link i {
    font-size: 1.25rem;
}

.mobile-bottom-nav .nav-link.active {
    color: var(--accent);
}

/* Mobile Header (Hamburger) */
.mobile-header {
    display: none;
    background: var(--sidebar-bg);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 500;
}

.hamburger-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Tablet and below optimization */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .mobile-header,
    .mobile-bottom-nav {
        display: flex;
        width: 100%;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        max-width: 80vw;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.6);
        padding: 2rem 1.5rem;
        height: 100vh;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0.75rem 0;
        padding-bottom: 80px;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        position: relative;
    }

    .top-nav {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .content-row {
        grid-template-columns: 1fr;
    }

    /* CARD UI for Tables on Mobile - ENHANCED */
    .data-table thead {
        display: none;
    }

    .card {
        padding: 0.75rem !important;
        border-radius: 0.75rem !important;
        margin: 0 16px 1.25rem 16px !important;
        width: calc(100% - 32px) !important;
        overflow: hidden;
    }

    .data-table tr {
        display: block;
        background: var(--card-bg);
        margin-bottom: 0.75rem;
        border-radius: 0.5rem;
        padding: 0;
        /* Changed to 0 as product-list handles it */
        border: 1px solid var(--border);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        position: relative;
        overflow: hidden;
        width: 100%;
    }

    .data-table tr::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        width: 4px;
        height: 100%;
        background: var(--accent);
    }

    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.85rem 1.25rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        text-align: right;
        font-size: 0.95rem;
        position: relative;
    }

    .data-table td:last-child {
        border-bottom: none;
        margin-top: 0.5rem;
        justify-content: center;
        gap: 0.75rem;
        background: rgba(255, 255, 255, 0.02);
        padding: 1rem 1.25rem;
    }

    .data-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-muted);
        text-align: left;
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 0.05rem;
    }

    .post-title-cell {
        max-width: 100%;
        white-space: normal !important;
        text-align: right;
        font-weight: 600;
        color: var(--text-main);
        line-height: 1.4;
    }

    /* Product List Specific Card Enhancements */
    .product-list tr {
        padding: 0;
        border-radius: 0.5rem;
    }

    .product-list td[data-label="이미지"] {
        flex-direction: column;
        align-items: center;
        padding: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        background: rgba(0, 0, 0, 0.2);
    }

    .product-list td[data-label="이미지"]::before {
        display: none;
    }

    .product-list td[data-label="이미지"] .thumb-preview {
        width: 100%;
        max-width: 100%;
        height: 180px;
        object-fit: contain;
        border-radius: 0;
        border: none;
    }

    .product-list td[data-label="선택"] {
        position: absolute;
        top: 0.75rem;
        left: 0.75rem;
        width: auto;
        background: rgba(0, 0, 0, 0.5);
        padding: 4px;
        border-radius: 4px;
        border-bottom: none;
        z-index: 10;
        border-right: none;
    }

    .product-list td[data-label="선택"]::before {
        display: none;
    }

    .product-list td[data-label="상태정보"] {
        position: absolute;
        top: 0.75rem;
        right: 0.75rem;
        width: auto !important;
        padding: 0 !important;
        border-bottom: none !important;
        z-index: 10;
        background: transparent !important;
    }

    .product-list td[data-label="상태정보"]::before {
        display: none;
    }

    .product-list td[data-label="상품정보"],
    .product-list td[data-label="상태정보"],
    .product-list td[data-label="등록일지"] {
        padding: 0.8rem 1.25rem;
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        width: 100%;
        overflow-wrap: break-word;
    }

    .product-list td[data-label="상품정보"]::before {
        display: none;
    }

    .product-list td[data-label="등록일지"]::before {
        margin-bottom: 0.2rem;
        font-size: 0.7rem;
    }

    .product-list td[data-label="관리동작"] {
        margin: 0;
        padding: 0.5rem 0.75rem;
        border-radius: 0 0 0.5rem 0.5rem;
        justify-content: center;
        background: rgba(255, 255, 255, 0.03);
    }

    .product-list td[data-label="관리동작"]::before {
        display: none;
    }

    .product-list .action-buttons {
        display: flex;
        gap: 15px;
        width: 100%;
        justify-content: center;
    }

    .product-list .action-buttons .btn-ghost {
        padding: 8px 12px !important;
        font-size: 1.1rem;
    }

    /* Mobile Utilities */
    .m-full {
        width: 100% !important;
    }

    .m-stack {
        flex-direction: column !important;
    }

    .m-hidden {
        display: none !important;
    }

    .m-mt-1 {
        margin-top: 1rem !important;
    }

    .m-mb-1 {
        margin-bottom: 1rem !important;
    }

    .m-p-0 {
        padding: 0 !important;
    }

    /* Form Adjustments */
    .form-group {
        margin-bottom: 1.25rem;
    }

    .btn {
        width: 100%;
        justify-content: center;
        padding: 0.9rem;
    }

    .card-header .btn {
        width: auto !important;
        padding: 0.5rem 0.8rem !important;
        margin: 0 !important;
    }

    .account-item {
        flex-wrap: wrap;
        padding: 0.85rem;
    }

    .acc-email {
        word-break: break-all;
        font-size: 0.85rem !important;
    }

    .acc-details {
        min-width: 0;
        /* Important for flex child overflow */
    }

    .top-actions {
        width: 100%;
    }

    /* Overlays */
    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.8);
        z-index: 990;
        backdrop-filter: blur(4px);
    }

    .overlay.active {
        display: block;
    }

    /* Input focus fix for mobile */
    .form-control {
        font-size: 16px !important;
    }

    /* Prevents iOS auto-zoom */
}

@media (max-width: 480px) {
    .dashboard-header h1 {
        font-size: 1.5rem;
    }

    .stat-card {
        padding: 1rem;
    }
}
/* Shortcuts Grid - Modern Widget Layout */
.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
    margin: 1.5rem 0 2.5rem 0;
    padding: 0 1rem;
}

.shortcut-card {
    background: var(--card-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border);
    padding: 1.5rem 1rem;
    border-radius: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.shortcut-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.2);
}

.shortcut-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
    transition: all 0.3s ease;
}

.shortcut-card:hover .shortcut-icon {
    background: var(--accent);
    color: white;
    transform: rotate(5deg);
}

.shortcut-label {
    display: block;
    color: var(--text-main);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.02em;
}

/* Shortcuts Grid Mobile Tuning */
@media (max-width: 768px) {
    .shortcuts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        padding: 0 16px;
    }
    
    .shortcut-card {
        padding: 1.25rem 0.75rem;
    }
    
    .shortcut-icon {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }
    
    .shortcut-label {
        font-size: 0.9rem;
    }
}
