/* 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-btn.unsubmitted {
    background: white;
    color: rgba(107, 114, 128, 0.8);
    border-color: #d1d5db;
    cursor: default;
}

.decoration-btn.unsubmitted:hover {
    background: white;
    border-color: #d1d5db;
    transform: none;
}

.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-header {
    margin-bottom: 0.75rem;
    position: relative;
    overflow: visible;
}

.shop-name-link {
    text-decoration: none;
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s;
    border-bottom: 1px solid #93c5fd;
    padding-bottom: 1px;
    position: relative;
}

.shop-name-link:hover {
    color: #1d4ed8;
    border-bottom-color: #1d4ed8;
    transform: translateY(-1px);
    background: #eff6ff;
    padding: 2px 4px;
    margin: -2px -4px;
    border-radius: 4px;
}

.shop-name-link::after {
    content: "地図を開く";
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    background: #1f2937;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: normal;
    white-space: nowrap;
    transition: transform 0.2s;
    pointer-events: none;
}

.shop-name-link:hover::after {
    transform: translateX(-50%) scale(1);
}

.shop-name-link:active {
    transform: translateY(0);
}

.shop-name {
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
}

.map-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.shop-address {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.5rem;
    line-height: 1.4;
}

.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;
}

.unsubmitted-card {
    border-left: 4px solid #ef4444;
    opacity: 0.7;
}

.area-badge.unsubmitted {
    background: #fee2e2;
    color: #dc2626;
}

.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;
    }
}