@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@500;700;900&display=swap');

:root {
    --md-sys-color-primary: #006495;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #cbebff;
    --md-sys-color-on-primary-container: #001e30;
    --md-sys-color-background: #f8fdff;
    --md-sys-color-surface-container: #e6f2ff;
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
    --ease-in-out-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ====== グローバルアニメーション定義 ====== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 8px 24px rgba(0, 100, 149, 0.3); }
    50% { box-shadow: 0 12px 32px rgba(0, 100, 149, 0.5); }
}

html, body { 
    height: 100%; 
    margin: 0; 
    padding: 0; 
    overflow: hidden;
    font-family: 'Noto Sans JP', sans-serif; 
    background-color: var(--md-sys-color-background); 
    -webkit-tap-highlight-color: transparent;
}

#app-wrapper {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: #fff;
    position: relative;
    overflow: hidden;
    opacity: 0;
    animation: fadeIn 0.6s var(--ease-in-out-smooth) 0.2s forwards;
}

#app-content {
    flex: 1; 
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.m3-input {
    width: 100%;
    padding: 18px 20px;
    border-radius: 24px;
    background-color: var(--md-sys-color-surface-container);
    border: 2px solid transparent;
    font-size: 18px;
    font-weight: 700;
    color: #001e30;
    outline: none;
    transition: all 0.3s var(--ease-out-expo);
    animation: fadeInUp 0.6s var(--ease-out-expo);
}

.m3-input:focus {
    background-color: #fff;
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 3px rgba(0, 100, 149, 0.1);
    transform: translateY(-2px);
}

.m3-input:hover:not(:focus) {
    background-color: rgba(203, 235, 255, 0.7);
    transform: translateY(-1px);
}

.btn-press {
    transition: transform 0.15s var(--ease-out-expo), 
                opacity 0.2s var(--ease-out-expo),
                box-shadow 0.2s var(--ease-out-expo);
    position: relative;
}

.btn-press:active { 
    transform: scale(0.94); 
    opacity: 0.9; 
}

.btn-press:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.shake { 
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both; 
}

@keyframes shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-3px); }
    40%, 60% { transform: translateX(3px); }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s var(--ease-in-out-smooth);
}

.loading-overlay p {
    animation: pulse 2s ease-in-out infinite;
}

.tab-hidden { 
    display: none;
    animation: fadeOut 0.3s var(--ease-in-out-smooth);
}

.tab-visible {
    animation: fadeIn 0.3s var(--ease-in-out-smooth);
}

.chip { 
    padding: 6px 14px; 
    border-radius: 14px; 
    font-size: 13px; 
    font-weight: 900;
    transition: all 0.2s var(--ease-out-expo);
    display: inline-block;
    animation: scaleIn 0.3s var(--ease-spring);
}

.chip:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.chip-absent { 
    background: #ffdad6; 
    color: #410002;
}

.chip-late { 
    background: #ffeb99; 
    color: #251a00;
}

#fab {
    position: fixed;
    bottom: 250px;
    right: 24px;
    width: 72px;
    height: 72px;
    border-radius: 24px;
    background: var(--md-sys-color-primary);
    color: white;
    box-shadow: 0 8px 24px rgba(0, 100, 149, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    transition: all 0.3s var(--ease-out-expo);
    animation: slideInFromRight 0.5s var(--ease-out-expo);
    border: none;
    cursor: pointer;
}

#fab:hover {
    animation: glow 2s ease-in-out infinite;
    transform: scale(1.1);
}

#fab:active {
    transform: scale(0.95);
}

.modal-hidden { 
    opacity: 0; 
    pointer-events: none; 
    visibility: hidden;
    transition: all 0.3s var(--ease-in-out-smooth);
}

.modal-visible { 
    opacity: 1; 
    pointer-events: auto; 
    visibility: visible;
    animation: fadeIn 0.3s var(--ease-in-out-smooth);
}

#modal-content { 
    transition: transform 0.4s var(--ease-spring);
}

.modal-hidden #modal-content { transform: translateY(100%); }
.modal-visible #modal-content { transform: translateY(0); }

.ai-sparkle {
    background: linear-gradient(90deg, #006495, #6b538c, #006495);
    background-size: 200% auto;
    animation: shine 3s linear infinite;
    position: relative;
    overflow: hidden;
    transition: all 0.3s var(--ease-out-expo);
}

.ai-sparkle::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    animation: shimmer 2s infinite;
}

.ai-sparkle:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 8px 24px rgba(107, 83, 140, 0.4);
}

@keyframes shine {
    to { background-position: 200% center; }
}

.cork-bg {
    background-color: #e3cca6;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.08'/%3E%3C/svg%3E");
    box-shadow: inset 0 6px 16px rgba(0,0,0,0.1);
}

.sticky-note {
    position: relative;
    box-shadow: 2px 4px 8px rgba(0,0,0,0.12);
    transition: filter 0.3s var(--ease-spring);
    border-bottom-right-radius: 24px 6px;
    border-bottom-left-radius: 4px;
    min-height: 140px;
}

.sticky-note.animate-on-load {
    animation: fadeInUp 0.5s var(--ease-out-expo);
    animation-fill-mode: forwards;
}

.sticky-note::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 25px;
    height: 25px;
    background: linear-gradient(135deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.06) 100%);
    border-top-left-radius: 100%;
}

.sticky-note:hover {
    filter: drop-shadow(5px 12px 28px rgba(0,0,0,0.2));
    z-index: 10;
}
        
/* ====== リスト・カードアイテムのアニメーション ====== */
.absence-item,
.board-item {
    animation: fadeInUp 0.5s var(--ease-out-expo);
    transition: all 0.3s var(--ease-in-out-smooth);
}

.absence-item:hover,
.board-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.idea-item {
    transition: all 0.3s var(--ease-in-out-smooth);
}

.idea-item:hover {
    filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.1));
}

/* ====== ヘッダーアニメーション ====== */
header {
    animation: slideInFromLeft 0.5s var(--ease-out-expo) 0.1s backwards;
}

header h1 {
    animation: fadeInUp 0.6s var(--ease-out-expo) 0.2s backwards;
}

header button {
    animation: slideInFromRight 0.5s var(--ease-out-expo) 0.2s backwards;
}

/* ====== ボタン全般 ====== */
button:not(.btn-press) {
    transition: all 0.3s var(--ease-out-expo);
}

button:not(.btn-press):hover {
    transform: translateY(-2px);
}

button:not(.btn-press):active {
    transform: scale(0.97);
}

/* ====== フォーム要素 ====== */
textarea.m3-input {
    animation: fadeInUp 0.6s var(--ease-out-expo);
}

/* ====== セクションタイトル ====== */
h2 {
    animation: fadeInUp 0.5s var(--ease-out-expo);
}

h2 i {
    transition: all 0.3s var(--ease-out-expo);
    animation: slideInFromLeft 0.5s var(--ease-out-expo) 0.1s backwards;
}

/* ====== 統計カード ====== */
.bg-\\[\\#ffdad6\\],
.bg-\\[\\#cbebff\\] {
    animation: fadeInUp 0.6s var(--ease-out-expo);
    transition: all 0.3s var(--ease-in-out-smooth);
}

.bg-\\[\\#ffdad6\\]:hover,
.bg-\\[\\#cbebff\\]:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.08);
}

/* ====== まとめボックス ====== */
.bg-\\[\\#fff9e6\\] {
    animation: slideInFromRight 0.5s var(--ease-out-expo);
}

/* ====== リスト内アイテムの段階的アニメーション ====== */
#absence-list > div,
#board-list > div,
#ideas-view > div {
    animation: fadeInUp 0.5s var(--ease-out-expo);
}

#absence-list > div:nth-child(1),
#board-list > div:nth-child(1),
#ideas-view > div:nth-child(1) {
    animation-delay: 0s;
}

#absence-list > div:nth-child(2),
#board-list > div:nth-child(2),
#ideas-view > div:nth-child(2) {
    animation-delay: 0.05s;
}

#absence-list > div:nth-child(3),
#board-list > div:nth-child(3),
#ideas-view > div:nth-child(3) {
    animation-delay: 0.1s;
}

#absence-list > div:nth-child(4),
#board-list > div:nth-child(4),
#ideas-view > div:nth-child(4) {
    animation-delay: 0.15s;
}

#absence-list > div:nth-child(n+5),
#board-list > div:nth-child(n+5),
#ideas-view > div:nth-child(n+5) {
    animation-delay: 0.2s;
}

/* ====== アイコンアニメーション ====== */
i[data-lucide] {
    transition: all 0.3s var(--ease-out-expo);
}

button:hover i[data-lucide],
a:hover i[data-lucide] {
    transform: scale(1.1) rotate(10deg);
}

/* ====== スムーズなフェードアウト ====== */
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ====== リップルエフェクト ====== */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* ====== スクロール時のトランジション ====== */
main {
    scroll-behavior: smooth;
}

/* ====== 遅延アニメーション用のクラス ====== */
.animate-delay-100 { animation-delay: 0.1s; }
.animate-delay-200 { animation-delay: 0.2s; }
.animate-delay-300 { animation-delay: 0.3s; }
.animate-delay-400 { animation-delay: 0.4s; }

/* ====== カラーピッカーのホバーアニメーション ====== */
label {
    transition: all 0.3s var(--ease-out-expo);
}

label:hover {
    transform: scale(1.15);
}

/* ====== ナビゲーションボタンのアニメーション ====== */
nav button {
    transition: all 0.3s var(--ease-out-expo);
    animation: slideInFromBottom 0.5s var(--ease-out-expo) backwards;
}

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

nav button:nth-child(1) { animation-delay: 0.1s; }
nav button:nth-child(2) { animation-delay: 0.2s; }
nav button:nth-child(3) { animation-delay: 0.3s; }
nav button:nth-child(4) { animation-delay: 0.4s; }

nav button:hover {
    transform: translateY(-4px);
}

nav button:active {
    transform: scale(0.95);
}

/* ====== ナビゲーションインジケーターのアニメーション ====== */
.group-open summary i,
nav div {
    transition: all 0.3s var(--ease-out-expo);
}

/* ====== フォーム要素の追加アニメーション ====== */
form {
    animation: fadeInUp 0.5s var(--ease-out-expo);
}

form > div,
form > button {
    animation: fadeInUp 0.5s var(--ease-out-expo);
}

form > div:nth-child(1) { animation-delay: 0s; }
form > div:nth-child(2) { animation-delay: 0.1s; }
form > div:nth-child(3) { animation-delay: 0.2s; }
form > button { animation-delay: 0.3s; }

/* ====== モーダルのスムーズなアニメーション ====== */
#absence-modal {
    animation: fadeIn 0.3s var(--ease-in-out-smooth);
}

#absence-modal > div:first-child {
    animation: fadeIn 0.3s var(--ease-in-out-smooth);
}

#modal-content {
    animation: slideInFromBottom 0.4s var(--ease-spring) 0.1s backwards;
}

/* ====== detailsタグのアニメーション ====== */
details {
    transition: all 0.3s var(--ease-in-out-smooth);
}

details[open] {
    box-shadow: 0 8px 32px rgba(0, 100, 149, 0.12);
}

details summary:hover {
    background-color: rgba(203, 235, 255, 0.3);
}

/* ====== ナビボタン配下のインジケーターアニメーション ====== */
nav div {
    position: relative;
    overflow: hidden;
}

nav div::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0;
    background: rgba(0, 100, 149, 0.05);
    transition: height 0.3s var(--ease-out-expo);
}

nav button:hover div::before {
    height: 100%;
}

#app-wrapper {
    display: none;
}