@extends('layouts.app')

@section('title', 'Settings | TAKEONE')

@section('extra_styles')
    <style>
        .settings-container {
            max-width: 600px;
        }
        
        .settings-card {
            background: var(--bg-secondary);
            border-radius: 12px;
            padding: 24px;
            margin-bottom: 24px;
        }
        
        .settings-title {
            font-size: 18px;
            font-weight: 500;
            margin-bottom: 20px;
            padding-bottom: 12px;
            border-bottom: 1px solid var(--border-color);
        }
        
        .form-group {
            margin-bottom: 16px;
        }
        
        .form-label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
        }
        
        .form-input {
            width: 100%;
            background: #121212;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 12px 16px;
            color: var(--text-primary);
            font-size: 14px;
        }
        
        .form-input:focus {
            outline: none;
            border-color: var(--brand-red);
        }
        
        .alert {
            padding: 12px 16px;
            border-radius: 8px;
            margin-bottom: 16px;
        }
        
        .alert-success {
            background: rgba(34, 197, 94, 0.2);
            border: 1px solid #22c55e;
            color: #22c55e;
        }
        
        .alert-danger {
            background: rgba(239, 68, 68, 0.2);
            border: 1px solid #ef4444;
            color: #ef4444;
        }
        
        .text-muted {
            color: var(--text-secondary);
            font-size: 12px;
        }
    </style>
@endsection

@section('content')
    <div class="settings-container">
        <h1 style="font-size: 24px; margin-bottom: 24px;">Settings</h1>
        
        <div class="settings-card">
            <h2 class="settings-title">Change Password</h2>
            
            @if(session('success'))
                <div class="alert alert-success">
                    {{ session('success') }}
                </div>
            @endif
            
            @if($errors->any())
                <div class="alert alert-danger">
                    {{ $errors->first() }}
                </div>
            @endif
            
            <form method="POST" action="{{ route('settings.update') }}">
                @csrf
                @method('PUT')
                
                <div class="form-group">
                    <label class="form-label">Current Password</label>
                    <input type="password" name="current_password" class="form-input" required>
                </div>
                
                <div class="form-group">
                    <label class="form-label">New Password</label>
                    <input type="password" name="new_password" class="form-input" required minlength="8">
                    <small class="text-muted">Minimum 8 characters</small>
                </div>
                
                <div class="form-group">
                    <label class="form-label">Confirm New Password</label>
                    <input type="password" name="new_password_confirmation" class="form-input" required>
                </div>
                
                <button type="submit" class="action-btn action-btn-primary">Update Password</button>
            </form>
        </div>
        
        <div class="settings-card">
            <h2 class="settings-title">Account Info</h2>
            
            <div class="form-group">
                <label class="form-label">Email</label>
                <input type="email" class="form-input" value="{{ $user->email }}" disabled>
                <small class="text-muted">Email cannot be changed</small>
            </div>
            
            <div class="form-group">
                <label class="form-label">Member Since</label>
                <input type="text" class="form-input" value="{{ $user->created_at->format('F d, Y') }}" disabled>
            </div>
        </div>
        
        <div class="settings-card">
            <h2 class="settings-title">Quick Links</h2>
            
            <a href="{{ route('profile') }}" class="action-btn action-btn-primary">
                <i class="bi bi-person"></i> <span>Edit Profile</span>
            </a>

            <a href="{{ route('channel', $user->channel) }}" class="action-btn action-btn-primary ms-2">
                <i class="bi bi-play-btn"></i> <span>My Channel</span>
            </a>
        </div>
    </div>
@endsection

