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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #e0dadc;
    min-height: 100vh;
    padding: 20px;
    /* iOS safe area insets */
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    text-align: center;
}

header h1 {
    color: #667eea;
    font-size: 2.5em;
}

header h1 i {
    margin-right: 10px;
}

.ticket-form, .ticket-filters, .ticket-list {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.ticket-form h2, .ticket-filters h2, .ticket-list h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.ticket-form h2 i, .ticket-filters h2 i, .ticket-list h2 i {
    margin-right: 10px;
    color: #667eea;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn i {
    margin-right: 8px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    color: #555;
}

.filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.filter-btn i {
    margin-right: 8px;
}

.count-badge {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    margin-left: 10px;
}

#ticketsContainer {
    display: grid;
    gap: 20px;
}

.ticket-card {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s;
    background: #fafafa;
    cursor: pointer;
    position: relative;
}

.ticket-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.ticket-title {
    font-size: 1.3em;
    font-weight: 700;
    color: #333;
    flex: 1;
}

.ticket-priority {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    margin-left: 10px;
}

.priority-high {
    background: #ff4757;
    color: white;
}

.priority-medium {
    background: #ffa502;
    color: white;
}

.priority-low {
    background: #26de81;
    color: white;
}

.ticket-info-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.ticket-info-item {
    color: #666;
    font-size: 0.95em;
    line-height: 1.6;
}

.ticket-info-item i {
    margin-right: 8px;
    color: #667eea;
    width: 16px;
    text-align: center;
}

.ticket-status-display {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.status-indicator {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9em;
}

.status-indicator.open {
    background: #e0e0e0;
    color: #555;
}

.status-indicator.in-progress {
    background: #667eea;
    color: white;
}

.status-indicator.completed {
    background: #26de81;
    color: white;
}

.status-indicator i {
    margin-right: 8px;
}

.ticket-status {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.status-btn {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9em;
    font-weight: 600;
}

.status-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.status-btn:hover:not(.active) {
    border-color: #667eea;
    color: #667eea;
}

.ticket-actions {
    display: flex;
    gap: 10px;
}

.btn-delete {
    background: #ff4757;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-delete:hover {
    background: #e84142;
    transform: translateY(-2px);
}

.btn-delete i {
    margin-right: 5px;
}

.no-tickets {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.no-tickets i {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-tickets p {
    font-size: 1.2em;
}

/* チケット詳細画面（全画面スライド） */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: -webkit-linear-gradient(top, #a8a9b8 0%, #5a5d70 50%, #3a3d52 100%);
    background: linear-gradient(to bottom, #a8a9b8 0%, #5a5d70 50%, #3a3d52 100%);
    overflow-y: auto;
}

.modal.show {
    display: block;
    animation: slideInRight 0.3s ease-out;
}

.modal.closing {
    animation: slideOutRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(100%);
    }
}

.modal-content {
    background: white;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    /* iOS safe area insets */
    padding-top: max(20px, env(safe-area-inset-top));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
}

.modal-close {
    background: #f0f0f0;
    border: none;
    color: #333;
    font-size: 1.2em;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.modal-close:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

.modal-close:active {
    transform: scale(0.95);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3em;
    flex: 1;
    color: #333;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    /* iOS safe area insets */
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.modal-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-item label {
    font-weight: 600;
    color: #555;
    font-size: 0.9em;
}

.info-item label i {
    margin-right: 8px;
    color: #667eea;
}

.info-item span {
    font-size: 1em;
    color: #333;
}

.priority-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9em;
}

.priority-badge.high {
    background: #ff4757;
    color: white;
}

.priority-badge.medium {
    background: #ffa502;
    color: white;
}

.priority-badge.low {
    background: #26de81;
    color: white;
}

.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9em;
}

.status-badge.open {
    background: #e0e0e0;
    color: #333;
}

.status-badge.in-progress {
    background: #667eea;
    color: white;
}

.status-badge.completed {
    background: #26de81;
    color: white;
}

.modal-description {
    margin-bottom: 30px;
}

.modal-description label {
    font-weight: 600;
    color: #555;
    font-size: 1em;
    display: block;
    margin-bottom: 12px;
}

.modal-description label i {
    margin-right: 8px;
    color: #667eea;
}

.modal-description p {
    color: #666;
    line-height: 1.8;
    font-size: 1em;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.status-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.status-action-btn {
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95em;
    font-weight: 600;
    color: #555;
    flex: 1;
    min-width: 130px;
}

.status-action-btn:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
}

.status-action-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.status-action-btn i {
    margin-right: 8px;
}

.btn-delete-modal {
    background: #ff4757;
    color: white;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    font-size: 1em;
    width: 100%;
}

.btn-delete-modal:hover {
    background: #e84142;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 71, 87, 0.3);
}

.btn-delete-modal i {
    margin-right: 8px;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }

    .filter-buttons {
        flex-direction: column;
    }

    .filter-btn {
        width: 100%;
    }

    .ticket-header {
        flex-direction: column;
    }

    .ticket-priority {
        margin-left: 0;
        margin-top: 10px;
        align-self: flex-start;
    }

    .modal-header {
        padding: 15px;
        /* iOS safe area insets for mobile */
        padding-top: max(15px, env(safe-area-inset-top));
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }

    .modal-header h2 {
        font-size: 1.1em;
    }

    .modal-close {
        width: 36px;
        height: 36px;
        font-size: 1em;
    }

    .modal-body {
        padding: 15px;
        /* iOS safe area insets for mobile */
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }

    .modal-info {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .status-buttons {
        flex-direction: column;
    }

    .status-action-btn {
        min-width: 100%;
    }
}

/* ================================================
   Ticket Detail Modal (ticket_app.html style)
   ================================================ */

/* Modal Container */
.modal-container {
    max-width: 414px;
    margin: 0 auto;
    background-color: transparent;
    min-height: 100vh;
    padding-bottom: 160px;
    position: relative;
    z-index: 1;
}

/* Modal Navigation Bar */
.modal-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
    animation: slideDown 0.5s ease-out 0.1s both;
}

.nav-bar {
    background-color: #424242;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.modal-nav-back {
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    transition: transform 0.2s ease, opacity 0.2s ease;
    color: #000;
}

.modal-nav-back:active {
    transform: scale(0.9);
    opacity: 0.7;
}

.modal-nav-title {
    font-size: 18px;
    font-weight: 600;
    color: #000;
}

.modal-nav-spacer {
    width: 24px;
}

/* Stamp Animation */
.stamp-container {
    position: absolute;
    top: 50px;
    right: 25px;
    transform: scale(3);
    transform-origin: center center;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.stamp-container.is-stamped {
    transform: scale(1) rotate(-15deg);
    opacity: 0.9;
}

.stamp-image {
    width: 160px;
    height: 160px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

/* Modal Ticket Section */
.modal-ticket-section {
    padding: 16px;
    padding-top: 20px;
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
    position: relative;
}

.modal-ticket-card {
    background: linear-gradient(to bottom, #ffffff 0%, #ffffff 57%, #f5f5f5 57%, #f5f5f5 100%);
    border-radius: 0;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.6s ease-out 0.2s both;
    margin-top: 8px;
    position: relative;
    will-change: transform, opacity;
    transition: transform 0.3s ease;
    overflow: hidden;
}

/* 点線の切り取り線と両端のドット */
.modal-ticket-card::before {
    content: '';
    position: absolute;
    top: 57%;
    left: 0;
    width: 100%;
    height: 2px;
    z-index: 2;
    pointer-events: none;
    /* 点線パターン */
    background-image:
        /* 左端の円形ドット */
        radial-gradient(circle at 0 center, #d0d0d0 3px, transparent 3px),
        /* 右端の円形ドット */
        radial-gradient(circle at 100% center, #d0d0d0 3px, transparent 3px),
        /* 中央の点線パターン */
        repeating-linear-gradient(
            to right,
            transparent 0px,
            transparent 6px,
            #d0d0d0 6px,
            #d0d0d0 10px
        );
    background-size:
        12px 12px,  /* 左端ドット */
        12px 12px,  /* 右端ドット */
        16px 1px;   /* 点線パターン */
    background-position:
        0 center,     /* 左端ドット */
        100% center,  /* 右端ドット */
        12px center;  /* 点線（左端ドットの後から開始） */
    background-repeat: no-repeat, no-repeat, repeat-x;
}

/* チケットカードの上部セクション（白） */
.modal-ticket-card-top {
    background-color: #ffffff;
    padding: 20px;
    position: relative;
    min-height: 57%;
}

/* チケットカードの下部セクション（グレー） */
.modal-ticket-card-bottom {
    background-color: #f5f5f5;
    padding: 20px;
    padding-top: 30px;
    position: relative;
    border-radius: 0 0 24px 24px;
    min-height: 43%;
}

.modal-event-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 24px;
    color: #000;
    animation: fadeIn 0.6s ease-out 0.3s both;
}

.modal-ticket-info {
    margin-bottom: 18px;
    animation: fadeIn 0.5s ease-out both;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.modal-ticket-info.visible {
    opacity: 1;
    transform: translateY(0);
}

.modal-info-label {
    font-size: 12px;
    color: #ff6b35;
    font-weight: 600;
    margin-bottom: 4px;
}

.modal-info-value {
    font-size: 14px;
    color: #000;
    line-height: 1.4;
}

.modal-time-row {
    display: flex;
    gap: 32px;
    margin-bottom: 18px;
    animation: fadeIn 0.5s ease-out 0.7s both;
}

.modal-time-item {
    flex: 1;
}

.modal-time-value {
    font-size: 14px;
    color: #000;
    margin-top: 4px;
}

/* Status Actions */
.modal-status-actions {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 414px;
    display: flex;
    gap: 12px;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    background-color: #fff;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    z-index: 100;
}

.modal-status-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #9e9e9e;
}

.modal-status-btn:hover {
    color: #ff6b35;
}

.modal-status-btn:active {
    transform: scale(0.95);
}

.modal-status-btn.active {
    color: #ff6b35;
}

.modal-status-btn i {
    font-size: 24px;
    margin: 0;
}

.modal-status-btn .nav-label {
    font-size: 10px;
    font-weight: 400;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 414px) {
    .modal-container {
        width: 100%;
    }
}

/* ================================================
   Entrance Check Modal
   ================================================ */

/* 入場チェックモーダル */
.entrance-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 2000;
}

.entrance-modal.show {
    display: block;
    animation: slideInRight 0.3s ease-out;
}

.entrance-modal.closing {
    animation: slideOutRight 0.3s ease-out;
}

.entrance-container {
    max-width: 414px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: white;
}

/* ヘッダー */
.entrance-header {
    background: linear-gradient(135deg, #ff7043 0%, #ff6b35 100%);
    padding: 20px 16px;
    padding-top: max(20px, env(safe-area-inset-top));
    color: white;
}

.entrance-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.entrance-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.entrance-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.entrance-close:active {
    transform: scale(0.9);
}

.entrance-subtitle {
    font-size: 13px;
    margin: 0;
    opacity: 0.95;
}

/* メインコンテンツ */
.entrance-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

.entrance-user-info {
    text-align: center;
    margin-bottom: 60px;
}

.entrance-name {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 16px 0;
    color: #333;
}

.entrance-seat {
    font-size: 20px;
    margin: 0;
    color: #666;
}

/* プログレスサークル */
.entrance-progress {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-circle {
    position: absolute;
    top: 0;
    left: 0;
}

.progress-bg {
    stroke-dasharray: 8 8;
}

.progress-bar {
    stroke-dasharray: 880;
    stroke-dashoffset: 0;
    animation: progressAnimation 60s ease-out forwards;
}

@keyframes progressAnimation {
    from {
        stroke-dashoffset: 880;
    }
    to {
        stroke-dashoffset: 0;
    }
}

.progress-text {
    font-size: 80px;
    font-weight: 700;
    color: #999;
    position: relative;
    z-index: 1;
}

/* ホームインジケーター */
.entrance-home-indicator {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom) + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 134px;
    height: 5px;
    background-color: #000;
    border-radius: 3px;
    z-index: 10;
}

/* ロックアイコン */
.entrance-lock-icon {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom) + 20px);
    right: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 20px;
    z-index: 10;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(100%);
    }
}

