/* ============================================================
   管理画面スタイル
   ============================================================ */

:root {
    --sidebar-width: 240px;
    --header-height: 56px;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --success: #16a34a;
    --danger: #ef4444;
    --warning: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
    --font: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: #fff;
    overflow-y: auto;
    z-index: 100;
}
.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-700);
}
.sidebar-header h2 {
    font-size: 16px;
    font-weight: 700;
}
.sidebar-header .shop-name {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 2px;
}
.sidebar-nav {
    padding: 12px 0;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--gray-300);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}
.sidebar-nav a:hover { background: var(--gray-800); color: #fff; }
.sidebar-nav a.active { background: var(--primary); color: #fff; }
.sidebar-nav .nav-icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-nav .nav-divider {
    border-top: 1px solid var(--gray-700);
    margin: 8px 0;
}

/* ---- Main ---- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}
.main-header {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}
.main-header .page-title {
    font-size: 18px;
    font-weight: 700;
}
.main-header .header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.main-body {
    padding: 24px;
}

/* ---- Cards ---- */
.admin-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}
.admin-card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--gray-800);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: var(--font);
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-50); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Forms ---- */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--gray-700);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row {
    display: flex;
    gap: 16px;
}
.form-row .form-group { flex: 1; }

/* ---- Admin Calendar ---- */
.admin-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--gray-200);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}
.admin-calendar .cal-header {
    background: var(--gray-700);
    color: #fff;
    text-align: center;
    padding: 8px;
    font-size: 13px;
    font-weight: 600;
}
.admin-calendar .cal-header.sun { color: #fca5a5; }
.admin-calendar .cal-header.sat { color: #93c5fd; }
.admin-calendar .cal-cell {
    background: #fff;
    min-height: 80px;
    padding: 8px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}
.admin-calendar .cal-cell:hover { background: var(--gray-50); }
.admin-calendar .cal-cell.today { background: #eff6ff; }
.admin-calendar .cal-cell.other-month { background: var(--gray-50); }
.admin-calendar .cal-cell.holiday { background: #fef2f2; }
.admin-calendar .cal-cell .day-num {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}
.admin-calendar .cal-cell .day-num.sun { color: var(--danger); }
.admin-calendar .cal-cell .day-num.sat { color: #2563eb; }
.admin-calendar .cal-cell .badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.admin-calendar .cal-cell .badge-count {
    background: var(--primary);
    color: #fff;
}
.admin-calendar .cal-cell .badge-closed {
    background: var(--gray-200);
    color: var(--gray-500);
    font-size: 10px;
}

/* ---- Timeline ---- */
.timeline-container {
    overflow-x: auto;
    position: relative;
}
.timeline-table {
    border-collapse: collapse;
    min-width: 100%;
}
.timeline-table th,
.timeline-table td {
    border: 1px solid var(--gray-200);
    padding: 0;
    position: relative;
}
.timeline-table th {
    background: var(--gray-50);
    padding: 8px 4px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}
.timeline-table .seat-label {
    position: sticky;
    left: 0;
    background: var(--gray-50);
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 11;
    min-width: 100px;
}
.timeline-table .time-cell {
    height: 48px;
    min-width: 60px;
    position: relative;
    vertical-align: top;
}
.timeline-block {
    position: absolute;
    top: 2px;
    bottom: 2px;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    color: #fff;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    z-index: 5;
    transition: opacity 0.2s;
    min-width: 40px;
}
.timeline-block:hover { opacity: 0.85; }
.timeline-block.confirmed { background: var(--primary); }
.timeline-block.arrived { background: var(--success); }
.timeline-block.cancelled { background: var(--gray-400); text-decoration: line-through; }

/* ---- Reservation List ---- */
.reservation-list {
    width: 100%;
    border-collapse: collapse;
}
.reservation-list th,
.reservation-list td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    font-size: 13px;
}
.reservation-list th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    position: sticky;
    top: 0;
}
.reservation-list tr:hover { background: var(--gray-50); }
.reservation-list tr.cancelled td { color: var(--gray-400); text-decoration: line-through; }

/* ---- Status Badge ---- */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.status-confirmed { background: #dbeafe; color: #1e40af; }
.status-arrived { background: #dcfce7; color: #166534; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    display: none;
}
.modal-overlay.active { display: flex; }
.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-400);
    padding: 0 4px;
}
.modal-close:hover { color: var(--gray-700); }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ---- Settings Cards ---- */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.item-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.item-card .item-name { font-size: 16px; font-weight: 700; }
.item-card .item-meta { font-size: 13px; color: var(--gray-500); }
.item-card .item-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

/* ---- Toggle ---- */
.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    display: inline-block;
}
.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--gray-300);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}
.toggle input:checked + .toggle-slider {
    background: var(--primary);
}
.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* ---- Weekday Buttons ---- */
.weekday-buttons {
    display: flex;
    gap: 6px;
}
.weekday-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.weekday-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ---- Alert ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ---- Login ---- */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
}
.login-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 360px;
    max-width: 90%;
}
.login-card h1 {
    font-size: 20px;
    text-align: center;
    margin-bottom: 8px;
}
.login-card .subtitle {
    text-align: center;
    color: var(--gray-500);
    font-size: 13px;
    margin-bottom: 24px;
}
.login-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 10px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

/* ---- Mobile Menu Button ---- */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 200;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius);
    background: var(--gray-900);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px;
}
.mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
}

/* ---- Sidebar Close Button ---- */
.sidebar-close {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.sidebar-close:hover { color: #fff; }

/* ---- Sidebar Overlay ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .mobile-menu-btn { display: flex; }
    .sidebar-close { display: block; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
    .main-header {
        padding-left: 60px;
    }
    .main-body {
        padding: 16px;
    }

    /* Calendar adjustments */
    .admin-calendar .cal-cell {
        min-height: 56px;
        padding: 4px;
    }
    .admin-calendar .cal-cell .day-num { font-size: 12px; }
    .admin-calendar .cal-cell .badge { font-size: 10px; padding: 1px 5px; }

    /* Timeline scroll */
    .timeline-container { -webkit-overflow-scrolling: touch; }

    /* Reservation list responsive */
    .reservation-list th,
    .reservation-list td {
        padding: 8px 6px;
        font-size: 12px;
    }

    /* Form layout */
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    /* Settings grid */
    .settings-grid {
        grid-template-columns: 1fr;
    }
}
