/* =========================
   Water Ripple Effect CSS
   ========================= */

/* カスタムカーソル */
.custom-cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: all 0.1s ease;
    mix-blend-mode: difference;
}

/* 波紋エフェクトのコンテナ */
.ripple-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 998;
}

/* 連続的な波紋要素 */
.water-ripple {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 30%, transparent 70%);
    transform: scale(0);
    animation: water-ripple-animation 2s ease-out;
    pointer-events: none;
}

@keyframes water-ripple-animation {
    0% {
        transform: scale(0);
        opacity: 0.8;
        border-width: 3px;
    }
    50% {
        opacity: 0.4;
        border-width: 2px;
    }
    100% {
        transform: scale(8);
        opacity: 0;
        border-width: 1px;
    }
}

/* より繊細な波紋 */
.subtle-ripple {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 50%);
    transform: scale(0);
    animation: subtle-ripple-animation 1.5s ease-out;
    pointer-events: none;
}

@keyframes subtle-ripple-animation {
    0% {
        transform: scale(0);
        opacity: 0.6;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* カーソル周りの光る効果 */
.cursor-glow {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.1) 40%, transparent 70%);
    transform: scale(0);
    animation: cursor-glow-animation 1s ease-out;
    pointer-events: none;
}

@keyframes cursor-glow-animation {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* デフォルトカーソルを非表示（適用したい要素に） */
.water-ripple-area {
    cursor: none;
}

/* タッチデバイス用 */
@media (hover: none) {
    .water-ripple-area {
        cursor: default;
    }
    
    .custom-cursor {
        display: none;
    }
}

/* =========================
   Base Styles & Reset
   ========================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', 'Noto Sans JP', sans-serif;
    background: linear-gradient(135deg, #0066ff 0%, #000000 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 10px;
}

/* 背景のアニメーション効果 */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" patternUnits="userSpaceOnUse" width="100" height="100"><circle cx="50" cy="50" r="0.5" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

/* 浮遊する幾何学的形状 */
.floating-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.shape {
    position: absolute;
    opacity: 0.1;
    animation: float-shapes 15s ease-in-out infinite;
}

.shape:nth-child(1) {
    top: 10%;
    left: 10%;
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    animation-delay: 0s;
}

.shape:nth-child(2) {
    top: 70%;
    right: 10%;
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.15);
    transform: rotate(45deg);
    animation-delay: 5s;
}

.shape:nth-child(3) {
    bottom: 20%;
    left: 20%;
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.1);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    animation-delay: 10s;
}

@keyframes float-shapes {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-30px) rotate(120deg); }
    66% { transform: translateY(30px) rotate(240deg); }
}

/* =========================
   メインコンテナ
   ========================= */

.container-fluid {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 100%;
    padding: 0;
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 50px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    max-width: 450px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    animation: slideUp 0.8s ease-out;
    width: 100%;
    min-width: 280px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #00d4ff, #000000, #0000ff);
    background-size: 200% 100%;
    animation: gradient-shift 3s ease-in-out infinite;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* =========================
   ロゴ・タイトルセクション
   ========================= */

.logo-section {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    width: 300px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    max-width: 100%;
}

.system-title {
    font-size: 28px;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #00d4ff, #0000cc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.3;
}

/* =========================
   フォーム要素
   ========================= */

.form-group {
    margin-bottom: 25px;
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
}

.form-input {
    width: 100%;
    padding: 16px 20px 16px 50px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    font-family: 'Roboto', 'Noto Sans JP', sans-serif;
    background: #fff;
    transition: all 0.3s ease;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-input:focus {
    border-color: #00d4ff;
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
    transform: translateY(-2px);
}

.form-input::placeholder {
    color: #a0aec0;
}

.input-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    font-size: 18px;
    transition: color 0.3s ease;
}

.form-input:focus + .input-icon {
    color: #00d4ff;
}

.login-button {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #0000ff 0%, #0066cc 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Roboto', 'Noto Sans JP', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    letter-spacing: 1px;
    margin-top: 10px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    touch-action: manipulation;
}

.login-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.login-button:hover::before {
    left: 100%;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 212, 255, 0.4);
}

.login-button:active {
    transform: translateY(0);
}

.error-message {
    color: #e53e3e;
    font-size: 13px;
    margin-top: 5px;
    display: none;
    padding: 8px 12px;
    background: rgba(229, 62, 62, 0.1);
    border-radius: 6px;
    border-left: 3px solid #e53e3e;
}

.forgot-password {
    text-align: center;
    margin-top: 30px;
}

.forgot-password a {
    color: #00d4ff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.forgot-password a:hover {
    color: #0066cc;
    text-decoration: underline;
}

/* ローディング状態 */
.login-button.loading {
    pointer-events: none;
    opacity: 0.8;
}

.login-button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =========================
   レスポンシブ対応
   ========================= */

/* 極小画面 (～320px) */
@media (max-width: 320px) {
    body {
        padding: 5px;
        overflow: auto;
    }
    
    /* 背景エフェクトを軽量化 */
    body::before {
        display: none;
    }
    
    .floating-shapes {
        display: none;
    }
    
    .custom-cursor {
        display: none !important;
    }
    
    .ripple-container {
        display: none !important;
    }
    
    .login-container {
        padding: 20px 15px;
        border-radius: 12px;
        min-width: 260px;
        max-width: 100%;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        backdrop-filter: blur(10px);
    }
    
    .logo {
        width: 160px;
        margin-bottom: 15px;
    }
    
    .system-title {
        font-size: 18px;
        line-height: 1.2;
        margin-bottom: 5px;
    }
    
    .logo-section {
        margin-bottom: 25px;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    .form-input {
        padding: 12px 14px 12px 40px;
        font-size: 16px;
        border-radius: 8px;
    }
    
    .input-icon {
        left: 12px;
        font-size: 14px;
    }
    
    .login-button {
        padding: 14px;
        font-size: 16px;
        border-radius: 8px;
        min-height: 48px;
    }
    
    .form-label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .forgot-password {
        margin-top: 20px;
    }
}

/* 小画面 (321px～480px) */
@media (min-width: 321px) and (max-width: 480px) {
    body {
        padding: 8px;
        overflow: auto;
    }
    
    /* 背景エフェクトを軽量化 */
    .floating-shapes {
        display: none;
    }
    
    .custom-cursor {
        display: none !important;
    }
    
    .ripple-container {
        display: none !important;
    }
    
    .login-container {
        padding: 25px 20px;
        border-radius: 15px;
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
        backdrop-filter: blur(15px);
    }
    
    .logo {
        width: 200px;
        margin-bottom: 15px;
    }
    
    .system-title {
        font-size: 22px;
    }
    
    .logo-section {
        margin-bottom: 30px;
    }
    
    .form-input {
        padding: 14px 16px 14px 45px;
        font-size: 16px;
        border-radius: 10px;
        min-height: 48px;
    }
    
    .input-icon {
        left: 15px;
        font-size: 16px;
    }
    
    .login-button {
        padding: 16px;
        font-size: 17px;
        border-radius: 10px;
        min-height: 48px;
    }
}

/* タブレット (481px～768px) */
@media (min-width: 481px) and (max-width: 768px) {
    body {
        padding: 15px;
        overflow: hidden;
    }
    
    /* 背景アニメーションは維持 */
    .floating-shapes {
        opacity: 0.5;
    }
    
    /* タッチデバイスでは波紋エフェクトを無効化 */
    .custom-cursor {
        display: none !important;
    }
    
    .ripple-container {
        display: none !important;
    }
    
    .login-container {
        padding: 35px 30px;
        border-radius: 18px;
        max-width: 420px;
    }
    
    .logo {
        width: 250px;
    }
    
    .system-title {
        font-size: 26px;
    }
    
    .form-input {
        padding: 15px 18px 15px 48px;
        font-size: 16px;
    }
    
    .login-button {
        padding: 17px;
        font-size: 17px;
    }
}

/* デスクトップ (769px～1024px) - フル機能 */
@media (min-width: 769px) {
    body {
        padding: 20px;
        overflow: hidden;
    }
    
    /* 全ての装飾エフェクトを有効化 */
    .floating-shapes {
        display: block;
    }
    
    /* マウス操作のデバイスでのみ波紋エフェクトを有効化 */
    @media (hover: hover) and (pointer: fine) {
        .custom-cursor {
            display: block;
        }
        
        .ripple-container {
            display: block;
        }
        
        .water-ripple-area {
            cursor: none;
        }
        
        .login-button:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 25px rgba(0, 212, 255, 0.4);
        }
        
        .form-input:focus {
            transform: translateY(-2px);
        }
    }
    
    .login-container {
        padding: 45px 40px;
        border-radius: 20px;
        max-width: 450px;
    }
    
    .logo {
        width: 280px;
    }
    
    .system-title {
        font-size: 28px;
        letter-spacing: 1px;
    }
    
    .form-input {
        padding: 16px 20px 16px 50px;
        font-size: 16px;
        border-radius: 12px;
    }
    
    .input-icon {
        left: 18px;
        font-size: 18px;
    }
    
    .login-button {
        padding: 18px;
        font-size: 18px;
        border-radius: 12px;
    }
}

/* 大画面デスクトップ (1025px～) */
@media (min-width: 1025px) {
    .login-container {
        padding: 50px 45px;
        max-width: 480px;
    }
    
    .logo {
        width: 300px;
    }
}

/* 縦向きスマホで極小高さの場合 */
@media (max-height: 600px) and (max-width: 480px) and (orientation: portrait) {
    body {
        align-items: flex-start;
        padding: 5px;
    }
    
    .login-container {
        margin: 5px auto;
        padding: 15px;
    }
    
    .logo-section {
        margin-bottom: 15px;
    }
    
    .logo {
        width: 120px;
        margin-bottom: 8px;
    }
    
    .system-title {
        font-size: 16px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-input {
        padding: 10px 12px 10px 35px;
        font-size: 16px;
    }
    
    .input-icon {
        left: 10px;
        font-size: 14px;
    }
    
    .login-button {
        padding: 12px;
        font-size: 15px;
    }
    
    .forgot-password {
        margin-top: 15px;
    }
}

/* 横向きスマホ対応 */
@media (max-height: 480px) and (orientation: landscape) {
    body {
        align-items: flex-start;
        padding: 10px;
        overflow: auto;
    }
    
    .floating-shapes {
        display: none;
    }
    
    .custom-cursor {
        display: none !important;
    }
    
    .ripple-container {
        display: none !important;
    }
    
    .login-container {
        margin: 10px auto;
        padding: 15px 25px;
        max-width: 400px;
    }
    
    .logo-section {
        margin-bottom: 15px;
    }
    
    .logo {
        width: 140px;
        margin-bottom: 8px;
    }
    
    .system-title {
        font-size: 18px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-input {
        padding: 10px 14px 10px 35px;
        font-size: 16px;
    }
    
    .input-icon {
        left: 10px;
        font-size: 14px;
    }
    
    .login-button {
        padding: 12px;
        font-size: 15px;
    }
    
    .forgot-password {
        margin-top: 15px;
    }
}

/* タッチデバイス全般での調整 */
@media (hover: none) and (pointer: coarse) {
    .water-ripple-area {
        cursor: default;
    }
    
    .custom-cursor {
        display: none !important;
    }
    
    .ripple-container {
        display: none !important;
    }
    
    .login-button:hover {
        transform: none;
        box-shadow: none;
    }
    
    .form-input:focus {
        transform: none;
    }
    
    /* タッチデバイス用のタップ領域最適化 */
    .login-button {
        min-height: 48px;
    }
    
    .form-input {
        min-height: 44px;
    }
    
    /* フォーカス時の拡大を防ぐ */
    .form-input {
        font-size: 16px;
    }
}

/* 高解像度デバイス対応 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .login-container {
        backdrop-filter: blur(25px);
    }
}

/* アクセシビリティ: 動きを減らす設定のユーザー向け */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .floating-shapes {
        display: none;
    }
    
    .custom-cursor {
        display: none !important;
    }
    
    .ripple-container {
        display: none !important;
    }
}

/* 印刷用スタイル */
@media print {
    body::before,
    .floating-shapes,
    .custom-cursor,
    .ripple-container {
        display: none !important;
    }
    
    body {
        background: white !important;
        overflow: visible !important;
    }
    
    .login-container {
        background: white !important;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        padding: 30px !important;
    }
    
    .system-title {
        color: #2d3748 !important;
        -webkit-text-fill-color: #2d3748 !important;
    }
}