/* ================================
   共通CSS - ヘッダーと基本スタイル
   ================================ */

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

/* Prevent zoom on all form inputs on iOS */
input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="search"],
textarea,
select {
    font-size: 16px !important; /* Prevent iOS zoom */
}

/* Additional iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    input, textarea, select {
        font-size: 16px !important;
    }
}

/* ================================
   ヘッダー共通スタイル
   ================================ */
.app-header,
.cms-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    background-blend-mode: overlay;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.app-title {
    font-size: 16px;
    font-weight: bold;
}

.app-title a {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.3s;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.app-title a:hover {
    opacity: 0.8;
}

.app-logo {
    height: 35px;
    width: auto;
    object-fit: contain;
}

.app-subtitle {
    color: white;
    font-size: 11px;
    font-weight: 400;
    margin: 0;
    white-space: nowrap;
    line-height: 1;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ================================
   テキストボタン
   ================================ */
.text-btn {
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.1) 100%);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    padding: 8px 16px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    white-space: nowrap;
    backdrop-filter: blur(5px);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.text-btn:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.2) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.text-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 通知ドット */
.notification-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 12px;
    height: 12px;
    background: #ff1744;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 2px rgba(255, 23, 68, 0.3);
    animation: pulse 2s infinite;
    
    /* 数字表示対応 */
    padding: 0 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
    color: white;
    font-weight: bold;
}

/* 数字が入る場合は円形から楕円形に */
.notification-dot:not(:empty) {
    border-radius: 10px;
    padding: 0 4px;
}

/* 通知ボタン専用スタイル */
.notification-btn {
    position: relative;
}

/* 通知ボタン内の通知ドット */
.notification-btn .notification-dot {
    position: absolute;
    top: -5px;
    right: -5px;
    margin-left: 0;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* ================================
   ドロップダウンメニュー
   ================================ */
.dropdown {
    position: relative;
}

.dropdown-btn {
    display: flex;
    align-items: center;
    gap: 5px;
}

.dropdown-arrow {
    font-size: 12px;
    transition: transform 0.3s;
}

.dropdown-content {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    color: #333;
    min-width: 150px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    border-radius: 8px;
    overflow: hidden;
    display: none;
    margin-top: 5px;
    z-index: 1000;
}

.dropdown-content.show {
    display: block;
}

.dropdown-item {
    padding: 12px 16px;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
    color: #333;
}

.dropdown-item:hover {
    background-color: #f5f5f5;
}

.dropdown-item.active {
    background-color: #e8e8e8;
    font-weight: 600;
}

/* ================================
   レスポンシブ対応
   ================================ */
@media (max-width: 768px) {
    /* Header adjustments for mobile */
    .app-header,
    .cms-header {
        padding: 10px 15px;
    }
    
    .header-content {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: space-between;
    }
    
    .app-title a {
        flex-direction: column;
        align-items: flex-start;
        gap: 1px;
    }
    
    .app-logo {
        height: 30px;
        max-width: 100%;
    }
    
    .app-subtitle {
        font-size: 10px;
        margin: 0;
    }
    
    .header-actions {
        gap: 5px;
        flex-wrap: wrap;
        justify-content: flex-end;
        max-width: 100%;
    }
    
    /* テキストボタンのモバイル対応 */
    .text-btn {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .notification-btn {
        position: relative;
    }
    
    .notification-dot {
        width: 10px;
        height: 10px;
        top: 2px;
        right: 2px;
    }
    
    /* ドロップダウンのモバイル対応 */
    .dropdown {
        position: relative;
    }
    
    .dropdown-arrow {
        font-size: 10px;
    }
    
    .dropdown-content {
        right: -10px;
        left: auto;
        min-width: 140px;
    }
    
    .dropdown-item {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* さらに小さい画面用の調整 */
@media (max-width: 480px) {
    .app-header,
    .cms-header {
        padding: 8px 10px;
    }
    
    .header-content {
        gap: 8px;
    }
    
    .app-logo {
        height: 25px;
    }
    
    .app-subtitle {
        font-size: 10px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
        gap: 3px;
    }
    
    .text-btn {
        padding: 5px 8px;
        font-size: 11px;
        flex: 1;
        min-width: 0;
    }
    
    /* 長いテキストの省略 */
    .header-mylist-btn {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .dropdown {
        flex: 0 0 auto;
    }
    
    .dropdown-content {
        right: 0;
        min-width: 130px;
    }
}