/* =============================================
   AIBuddy Admin - Rich Design Theme
   ============================================= */

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --accent: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    --card-shadow-hover: 0 20px 60px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    min-height: 100vh;
    margin: 0;
    padding: 2rem;
    color: #1e293b;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

h1 {
    margin-top: 0;
    border-bottom: none;
    padding-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.section {
    margin-bottom: 1.5rem;
    border: none;
    padding: 1.5rem;
    border-radius: 16px;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.section:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.section h3 {
    margin-top: 0;
    font-size: 1.15rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #475569;
    font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    box-sizing: border-box;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: #f8fafc;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

textarea.large {
    height: 200px;
}

textarea.small {
    height: 80px;
}

button {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 12px 28px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

button:active {
    transform: translateY(0);
}

.radio-group label {
    display: inline-flex;
    align-items: center;
    margin-right: 15px;
    font-weight: normal;
    cursor: pointer;
}

.radio-group input {
    margin-right: 5px;
}

.hidden {
    display: none;
}

/* Login View - Rich Style */
#login-view {
    max-width: 420px;
    margin: 80px auto;
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 24px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15);
}

#login-view h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

#login-view::before {
    content: '';
    display: block;
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
}

.login-input {
    margin-bottom: 1rem;
}

#login-view button {
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* Save Bar - Rich Style */
.save-bar {
    position: sticky;
    bottom: 0;
    background: linear-gradient(to top, white 0%, rgba(255, 255, 255, 0.95) 100%);
    padding: 1.2rem 1.5rem;
    border-top: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 -2rem -2rem;
    border-radius: 0 0 20px 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.05);
}

.save-bar.hidden {
    display: none !important;
}

.save-bar button {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    padding: 14px 35px;
    font-size: 1.05rem;
}

.save-bar button:hover {
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.status-msg {
    margin-right: 1rem;
    font-weight: 600;
    font-size: 0.95rem;
}

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

/* Header View - Rich Style */
#header-view:not(.hidden) {
    display: flex;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    padding: 1.2rem 2rem !important;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(255, 255, 255, 0.9);
}

#header-view h1 {
    background: none;
    -webkit-text-fill-color: #1e293b;
    font-size: 1.3rem;
}

/* Header Action Buttons */
#admin-nav-links button {
    padding: 10px 18px;
    font-size: 0.85rem;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: none;
}

#admin-nav-links button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* System News Widget - Rich Style */
#systemNewsWidget {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
    border: none !important;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.15);
}

#systemNewsWidget h3 {
    color: #b45309 !important;
}

/* Primary Button Variant */
.primary-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* Secondary Button Variant */
.secondary-btn {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    box-shadow: 0 4px 15px rgba(100, 116, 139, 0.3);
}

/* Danger Button Variant */
.danger-btn {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* Header Action Buttons */
.header-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px !important;
    font-size: 0.85rem !important;
    border-radius: 12px !important;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: none !important;
    border: none;
}

.header-btn .material-symbols-outlined {
    font-size: 18px;
}

.header-btn-purple {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%) !important;
    color: #7c3aed !important;
    border: 1px solid #ddd6fe !important;
}

.header-btn-purple:hover {
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%) !important;
}

.header-btn-green {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important;
    color: #15803d !important;
    border: 1px solid #bbf7d0 !important;
}

.header-btn-green:hover {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%) !important;
}

.header-btn-blue {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%) !important;
    color: #4338ca !important;
    border: 1px solid #a5b4fc !important;
}

.header-btn-blue:hover {
    background: linear-gradient(135deg, #c7d2fe 0%, #a5b4fc 100%) !important;
}

.header-btn-gray {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
    color: #64748b !important;
    border: 1px solid #cbd5e1 !important;
}

.header-btn-gray:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%) !important;
}

/* Form Group Spacing */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    margin-bottom: 0.6rem;
}

/* Page Title - Rich Style */
.page-title {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f1f5f9;
}

.page-title-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.page-title-icon .material-symbols-outlined {
    font-size: 28px;
    color: white;
}

.page-title h1 {
    font-size: 1.6rem;
    margin: 0;
    padding: 0;
    border: none;
}

.page-title-sub {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
}

/* Radio Group - Rich Style */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.radio-group label {
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    background: #f1f5f9;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    font-weight: 500;
}

.radio-group label:hover {
    background: #e2e8f0;
}

.radio-group input:checked+span,
.radio-group label:has(input:checked) {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary);
}

.radio-group input {
    margin-right: 8px;
    accent-color: var(--primary);
}

/* Premium Overlay - Plan Restriction */
#premium-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(3px);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.premium-overlay-content {
    text-align: center;
    padding: 2rem;
}

.premium-overlay-content h4 {
    margin: 1rem 0 0.5rem;
    color: #1e293b;
    font-size: 1.2rem;
}

.premium-overlay-content p {
    margin: 0.5rem 0;
    color: #475569;
}

/* News Item Hover Effect */
.news-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    filter: brightness(0.98);
}

/* Tabs - Rich Style */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 25px;
    border-bottom: 3px solid #e2e8f0;
    position: relative;
    padding: 0 5px;
}

.tab-btn {
    background: var(--tab-color, #6366f1);
    border: 2px solid var(--tab-color, #6366f1);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    padding: 12px 20px;
    cursor: pointer;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    position: relative;
    opacity: 0.7;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.tab-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.tab-btn.active {
    opacity: 1;
    background: white;
    color: var(--tab-color, #6366f1);
    transform: translateY(0);
    z-index: 1;
    margin-bottom: -3px;
    padding-bottom: 15px;
}

/* Tab Colors */
.tab-btn:nth-child(1) {
    --tab-color: #6366f1;
}

/* 基本設定 - Purple */
.tab-btn:nth-child(2) {
    --tab-color: #ec4899;
}

/* 店舗情報 - Pink */
.tab-btn:nth-child(3) {
    --tab-color: #14b8a6;
}

/* Q&A設定 - Teal */
.tab-btn:nth-child(4) {
    --tab-color: #f59e0b;
}

/* 会話ログ - Amber */
.tab-btn:nth-child(5) {
    --tab-color: #ef4444;
}

/* 応募一覧 - Red */

/* Tab Icons */
.tab-btn .material-symbols-outlined {
    font-size: 20px;
    font-weight: 400;
}

.tab-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.tab-badge.hidden {
    display: none;
}

/* Sub Tabs */
.sub-tab-btn {
    background: none;
    border: none;
    padding: 8px 15px;
    cursor: pointer;
    color: #64748b;
    font-size: 0.9rem;
    border-bottom: 2px solid transparent;
}

.sub-tab-btn.active {
    color: #e11d48;
    border-bottom: 2px solid #e11d48;
    font-weight: bold;
}

/* Modern Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    margin-right: 10px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    /* Gray-400 */
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background-color: #3b82f6;
    /* Blue-500 */
}

input:focus+.slider {
    box-shadow: 0 0 1px #3b82f6;
}

input:checked+.slider:before {
    transform: translateX(24px);
}

/* Mobile Navigation */
@media (max-width: 768px) {
    body {
        padding: 0.8rem;
        background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    }

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

    h1 {
        font-size: 1.3rem;
    }

    /* Page Title Mobile */
    .page-title {
        gap: 12px;
        margin-bottom: 20px;
        padding-bottom: 15px;
    }

    .page-title-icon {
        width: 46px;
        height: 46px;
        border-radius: 12px;
    }

    .page-title-icon .material-symbols-outlined {
        font-size: 22px;
    }

    .page-title h1 {
        font-size: 1.2rem;
    }

    /* Section Mobile */
    .section {
        padding: 1.2rem;
        border-radius: 12px;
    }

    /* Save Bar Mobile */
    .save-bar {
        margin: 0 -1.2rem -1.2rem;
        padding: 1rem;
        border-radius: 0 0 16px 16px;
    }

    .save-bar button {
        padding: 12px 24px;
        font-size: 0.95rem;
    }

    .hamburger-btn {
        display: block !important;
    }

    #admin-nav-links {
        display: none !important;
        position: absolute;
        top: 100%;
        right: 0;
        flex-direction: column;
        background: white;
        padding: 15px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        border-radius: 8px;
        z-index: 1000;
        width: 220px;
        border: 1px solid #e2e8f0;
    }

    #admin-nav-links.active {
        display: flex !important;
    }

    #admin-nav-links button {
        width: 100%;
        text-align: left;
        margin-bottom: 8px;
        justify-content: flex-start;
    }

    /* Stack Toggle for Mobile */
    .mobile-vertical-stack {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px;
    }

    .mobile-vertical-stack .text-wrapper {
        display: contents;
        /* Ungroups children so they participate in parent flex container */
    }

    .mobile-order-1 {
        order: 1;
        margin-bottom: 5px;
    }

    .mobile-order-2 {
        order: 2;
        margin-bottom: 5px;
    }

    .mobile-order-3 {
        order: 3;
    }

    /* Scrollable Tabs */
    .tabs {
        overflow-x: auto;
        white-space: nowrap;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
        margin-left: -20px;
        margin-right: -20px;
        padding-left: 15px;
        padding-right: 15px;
        gap: 0;
    }

    .tab-btn {
        padding: 10px 14px;
        font-size: 0.8rem;
        border-radius: 10px 10px 0 0;
    }

    .tab-btn .material-symbols-outlined {
        font-size: 18px;
    }

    .tab-btn.active {
        padding-bottom: 13px;
    }

    /* Hide scrollbar */
    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tabs {
        scrollbar-width: none;
    }
}

/* =============================================
   Feature Toggle Buttons (こだわり条件)
   ============================================= */
.feature-toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.feature-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 6px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    font-size: 0.82rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    user-select: none;
}

.feature-toggle:hover {
    border-color: #f9a8d4;
    color: #333;
}

.feature-toggle.active {
    background: linear-gradient(135deg, #fce7f3, #fdf2f8);
    border-color: #ec4899;
    color: #be185d;
    font-weight: 700;
    box-shadow: 0 0 0 1px rgba(236, 72, 153, 0.2);
}

/* Featured Candidates (clickable pool from checked items) */
.featured-candidates {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    min-height: 40px;
    margin-bottom: 8px;
}

.featured-candidates:empty::after {
    content: "まずは上のリストからこだわり条件をチェックしてください";
    color: #94a3b8;
    font-size: 0.8rem;
}

.candidate-btn {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    font-size: 0.8rem;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
}

.candidate-btn:hover {
    background: #fdf2f8;
    border-color: #f9a8d4;
    color: #be185d;
}

.candidate-btn.selected {
    background: #ec4899;
    color: white;
    border-color: #ec4899;
    font-weight: 600;
}

/* Selected 8 Tags Display */
.featured-selected-area {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
    background: #fdf2f8;
    border: 2px solid #f9a8d4;
    border-radius: 8px;
    min-height: 36px;
}

.featured-selected-area:empty::after {
    content: "↑ 条件をクリックして最大8つ選択";
    color: #f9a8d4;
    font-size: 0.8rem;
}

.featured-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: #ec4899;
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.featured-tag-remove {
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s;
    background: none;
    border: none;
    color: white;
    padding: 0 2px;
}

.featured-tag-remove:hover {
    opacity: 1;
}

/* =============================================
   Applications List & Modal
   ============================================= */
.app-status-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.app-status-badge.new {
    background: #ec4899;
    color: #fff;
}

.app-status-badge.read {
    background: #e2e8f0;
    color: #475569;
}

.app-row {
    transition: background 0.15s;
}

.app-row:hover {
    background: #fdf2f8;
}

.app-row-new {
    background: #fef7ff;
}

/* Application Detail Modal */
.app-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s;
}

.app-modal-overlay.show {
    opacity: 1;
}

.app-modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.2s;
}

.app-modal-overlay.show .app-modal-content {
    transform: translateY(0);
}

.app-modal-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
    border-bottom: 1px solid #fbcfe8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #be185d;
}

.app-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #f472b6;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.app-modal-close:hover {
    color: #be185d;
}

.app-modal-body {
    padding: 20px;
    overflow-y: auto;
}

.app-detail-section {
    margin-bottom: 16px;
}

.app-detail-row {
    display: flex;
    gap: 20px;
}

.app-detail-row .app-detail-section {
    flex: 1;
}

.app-detail-label {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-bottom: 4px;
}

.app-detail-value {
    font-size: 1rem;
    color: #1f2937;
    font-weight: 500;
}

.app-contact-value {
    font-family: monospace;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.app-detail-message {
    background: #fef7ff;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #fce7f3;
    font-size: 0.95rem;
    color: #374151;
    line-height: 1.5;
    white-space: pre-wrap;
}

.app-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
}

.app-modal-btn-close {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.app-modal-btn-close:hover {
    background: #e2e8f0;
}