/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, #f8f4ff 0%, #fdecf7 50%, #e7f3ff 100%);
    min-height: 100vh;
}

.app-container {
    min-height: 100vh;
}

/* Header styles */
.header {
    background: linear-gradient(135deg, #9333ea 0%, #ec4899 100%);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

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

.star-icon {
    color: #fbbf24;
    width: 2rem;
    height: 2rem;
}

.header-title h1 {
    font-size: 1.875rem;
    font-weight: bold;
    margin: 0;
}

.subtitle {
    margin-top: 0.5rem;
    color: #e0c7ff;
    font-size: 1rem;
}

/* Main content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* Search section */
.search-section {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Search mode buttons */
.search-mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
    .search-mode-buttons {
        flex-direction: row;
    }
}

.mode-btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #f3f4f6;
    color: #374151;
}

.mode-btn:hover {
    background: #e5e7eb;
}

.mode-btn.active {
    background: #9333ea;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.mode-btn.active.decoration {
    background: #ec4899;
}

.mode-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* School tabs */
.school-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.school-tab {
    padding: 0.5rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: #e5e7eb;
    color: #374151;
}

.school-tab:hover {
    background: #d1d5db;
}

.school-tab.active.chishogaku {
    background: #2563eb;
    color: white;
}

.school-tab.active.kitasho {
    background: #059669;
    color: white;
}

/* Class selection */
.class-selection {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.grade-section {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
}

.grade-header {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: between;
    font-weight: 500;
    color: #1f2937;
    transition: background-color 0.2s;
}

.grade-header:hover {
    background: #f3f4f6;
}

.grade-classes {
    padding: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
}

@media (min-width: 640px) {
    .grade-classes {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

@media (min-width: 768px) {
    .grade-classes {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

.class-btn {
    padding: 0.75rem;
    border: 2px solid #d1d5db;
    border-radius: 0.5rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.class-btn:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.class-btn.active {
    border-color: #9333ea;
    background: #f3e8ff;
    color: #7c3aed;
    font-weight: 500;
}

.class-btn-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.class-btn-count {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Decoration search */
.decoration-desc {
    color: #374151;
    margin-bottom: 1rem;
}

.decoration-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

@media (min-width: 640px) {
    .decoration-grid {
        grid-template-columns: repeat(7, 1fr);
    }
}

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

.decoration-btn {
    padding: 0.75rem;
    border: 2px solid #d1d5db;
    border-radius: 0.5rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-size: 0.875rem;
}

.decoration-btn:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.decoration-btn.active {
    border-color: #ec4899;
    background: #fdf2f8;
    color: #db2777;
    font-weight: bold;
}

.decoration-btn.central-booth {
    background: #f3f4f6;
    color: #6b7280;
    border-color: #9ca3af;
}

.decoration-btn.central-booth:hover {
    background: #e5e7eb;
    border-color: #6b7280;
}

.decoration-btn.central-booth.active {
    border-color: #6b7280;
    background: #e5e7eb;
    color: #374151;
    font-weight: bold;
}

.decoration-note {
    padding: 0.75rem;
    background: #fef3c7;
    color: #92400e;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

/* Results section */
.results-section {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 0.5rem;
}

.results-section.class-results {
    background: #f3e8ff;
}

.results-section.decoration-results {
    background: #fdf2f8;
}

.results-title {
    font-weight: bold;
    margin-bottom: 0.75rem;
    color: #1f2937;
}

.results-title.class {
    color: #7c3aed;
}

.results-title.decoration {
    color: #db2777;
}

.results-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.shop-card {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.shop-name {
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.shop-info {
    font-size: 0.875rem;
    color: #6b7280;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.area-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.area-badge.parkroad {
    background: #e0e7ff;
    color: #3730a3;
}

.area-badge.nishiguchi {
    background: #fce7f3;
    color: #be185d;
}

.area-badge.central {
    background: #f3f4f6;
    color: #6b7280;
}

.central-booth-card {
    border-left: 4px solid #9ca3af;
}

.shop-details {
    margin-top: 0.75rem;
    font-size: 0.875rem;
}

.detail-row {
    color: #6b7280;
    margin-bottom: 0.25rem;
}

/* Stats section */
.stats-section {
    margin-top: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

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

.stat-card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    text-align: center;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
}

.stat-card.purple .stat-number {
    color: #9333ea;
}

.stat-card.pink .stat-number {
    color: #ec4899;
}

.stat-card.blue .stat-number {
    color: #2563eb;
}

.stat-card.green .stat-number {
    color: #059669;
}

/* Number picker styles for mobile */
.mobile-picker-container {
    display: none;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.picker-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.picker-label {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.number-picker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.picker-select {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #d1d5db;
    border-radius: 0.5rem;
    background: white;
    font-size: 1rem;
    color: #374151;
}

.picker-select:focus {
    outline: none;
    border-color: #9333ea;
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

.desktop-interface {
    display: block;
}

/* Mobile responsive overrides */
@media (max-width: 640px) {
    .mobile-picker-container {
        display: flex;
    }
    
    .desktop-interface {
        display: none;
    }
    
    .decoration-grid {
        display: none !important;
    }
    
    .mobile-decoration-picker {
        display: flex !important;
        flex-direction: column;
        gap: 1rem;
    }
    
    .shop-card {
        padding: 0.75rem;
    }
    
    .shop-name {
        font-size: 1rem;
        word-break: break-word;
    }
    
    .area-badge {
        font-size: 0.6875rem;
        padding: 0.1875rem 0.375rem;
    }
}

/* Utility classes */
.hidden {
    display: none !important;
}

.chevron-icon {
    width: 1rem;
    height: 1rem;
    margin-left: auto;
    transition: transform 0.2s;
}

.chevron-icon.rotated {
    transform: rotate(180deg);
}

/* Responsive design */
@media (max-width: 640px) {
    .header-content {
        padding: 1rem;
    }
    
    .header-title h1 {
        font-size: 1.5rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .search-section {
        padding: 1rem;
    }
}

/* PWA Install Styles */
.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.pwa-install-section {
    position: relative;
}

.pwa-install-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.pwa-install-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pwa-install-btn svg {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-8px);
    }
    70% {
        transform: translateY(-4px);
    }
}

.ios-install-prompt {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    width: 280px;
    border: 1px solid #e5e7eb;
}

.ios-prompt-content {
    padding: 1.5rem;
    color: #374151;
}

.ios-prompt-content p {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

.ios-prompt-content p:last-of-type {
    margin-bottom: 1.25rem;
}

.ios-prompt-close {
    background: #6366f1;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
}

.ios-prompt-close:hover {
    background: #4f46e5;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .header-main {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .pwa-install-section {
        text-align: center;
    }
    
    .pwa-install-btn {
        width: 100%;
        justify-content: center;
        font-size: 1rem;
        padding: 1rem;
    }
    
    .ios-install-prompt {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        right: auto;
        margin: 0;
        width: 90%;
        max-width: 320px;
    }
}

/* 大画面インストールモーダル */
.install-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-in-out;
}

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

.install-modal-content {
    background: white;
    border-radius: 1rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

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

.install-modal-header {
    padding: 2rem 2rem 1rem 2rem;
    text-align: center;
    position: relative;
    background: linear-gradient(135deg, #9333ea 0%, #ec4899 100%);
    color: white;
    border-radius: 1rem 1rem 0 0;
}

.install-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1.4;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.3);
}

.install-benefits {
    display: flex;
    justify-content: space-around;
    padding: 1.5rem 2rem;
    background: #f8f4ff;
}

.benefit-item {
    text-align: center;
    flex: 1;
}

.benefit-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.benefit-item span:last-child {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6366f1;
}

.install-guide {
    padding: 2rem;
}

.guide-steps {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.guide-step {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.step-number {
    background: #6366f1;
    color: white;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content h3 {
    margin: 0 0 0.5rem 0;
    color: #374151;
    font-size: 1.1rem;
}

.step-content p {
    margin: 0;
    color: #6b7280;
    font-size: 0.9rem;
}

.ios-icon {
    font-size: 2rem;
    margin: 0.5rem 0;
}

.big-install-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.big-install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.understand-btn {
    background: #6366f1;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 1.5rem;
    transition: background 0.3s ease;
}

.understand-btn:hover {
    background: #4f46e5;
}

.modal-footer {
    padding: 1rem 2rem 2rem 2rem;
    text-align: center;
}

.maybe-later-btn {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
}

.maybe-later-btn:hover {
    color: #374151;
}

/* モバイル向け調整 */
@media (max-width: 640px) {
    .install-modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .install-modal-header {
        padding: 1.5rem 1rem 1rem 1rem;
    }
    
    .install-modal-header h2 {
        font-size: 1.25rem;
    }
    
    .install-benefits {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .install-guide {
        padding: 1.5rem 1rem;
    }
    
    .guide-step {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .step-number {
        align-self: center;
    }
}