<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Profile - Task Panel</title>
    
    <!-- Google Fonts -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400..700;1,400..700&display=swap" rel="stylesheet">
    
    <!-- Inline CSS for styling (Consistent with dashboard, projects & users, pure Vanilla CSS) -->
    <style>
        /* CSS Custom Variables */
        :root {
            --primary-color: #3b46f1;
            --primary-hover: #2a35d8;
            --primary-light: #eff6ff;
            --bg-main: #f8fafc;
            --bg-card: #ffffff;
            
            --text-main: #0f172a;
            --text-muted: #64748b;
            --text-label: #334155;
            --border-color: #e2e8f0;
            --border-hover: #cbd5e1;
            --font-family: 'Instrument Sans', sans-serif;

            --color-completed: #10b981;
            --color-completed-light: #ecfdf5;
            --color-hold: #ef4444;
            --color-hold-light: #fef2f2;
            
            --sidebar-width: 260px;
            --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
            --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
            --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
            --border-radius: 12px;
        }

        /* Global Reset & Base Styling */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: var(--font-family);
            background-color: var(--bg-main);
            color: var(--text-main);
            min-height: 100vh;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            overflow-x: hidden;
        }

        /* Main Page Layout Wrapper */
        .dashboard-layout {
            display: flex;
            position: relative;
            min-height: 100vh;
        }

        /* Main Content Panel Area */
        .main-content {
            margin-left: var(--sidebar-width);
            flex-grow: 1;
            padding: 2rem;
            display: flex;
            flex-direction: column;
            gap: 2rem;
            min-width: 0;
            transition: margin-left 0.3s ease;
        }

        /* Topbar Header Area */
        .topbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1.5rem;
            flex-wrap: wrap;
        }

        /* Right section: Admin Profile */
        .topbar-right {
            display: flex;
            align-items: center;
            gap: 1rem;
            margin-left: auto;
        }

        /* User Admin profile badge */
        .admin-profile {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            background-color: var(--bg-card);
            padding: 0.375rem 0.875rem 0.375rem 0.375rem;
            border-radius: 50px;
            border: 1px solid var(--border-color);
            box-shadow: var(--shadow-sm);
        }

        .avatar-initials {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: linear-gradient(135deg, #4f46e5, #3b82f6);
            display: flex;
            align-items: center;
            justify-content: center;
            color: #ffffff;
            font-weight: 700;
            font-size: 0.875rem;
            position: relative;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }

        .admin-info {
            display: flex;
            flex-direction: column;
            line-height: 1.2;
        }

        .admin-name {
            font-size: 0.875rem;
            font-weight: 700;
            color: var(--text-main);
        }

        .admin-role {
            font-size: 0.75rem;
            color: var(--text-muted);
            font-weight: 500;
        }

        /* Title block */
        .dashboard-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            animation: fadeIn 0.5s ease-out;
            flex-wrap: wrap;
            gap: 1rem;
        }

        .dashboard-title {
            font-size: 1.875rem;
            font-weight: 800;
            letter-spacing: -0.03em;
            color: var(--text-main);
        }

        /* Profile Layout Grid */
        .profile-container {
            display: grid;
            grid-template-columns: 1fr;
            max-width: 850px;
            margin: 0 auto;
            width: 100%;
            gap: 2rem;
            animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
        }

        /* Left Side: Summary Card */
        .profile-summary-card {
            background-color: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: var(--border-radius);
            padding: 2.5rem 2rem;
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
            box-shadow: var(--shadow-sm);
        }

        .large-avatar-frame {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            background: linear-gradient(135deg, #3b46f1, #8b5cf6);
            display: flex;
            align-items: center;
            justify-content: center;
            color: #ffffff;
            font-size: 2.25rem;
            font-weight: 800;
            margin-bottom: 1.5rem;
            box-shadow: 0 10px 20px rgba(59, 70, 241, 0.15);
            position: relative;
        }

        .summary-name {
            font-size: 1.25rem;
            font-weight: 800;
            color: var(--text-main);
            margin-bottom: 0.25rem;
        }

        .summary-role {
            font-size: 0.85rem;
            color: var(--text-muted);
            font-weight: 600;
            background-color: var(--bg-main);
            padding: 0.25rem 0.75rem;
            border-radius: 9999px;
            border: 1px solid var(--border-color);
            margin-bottom: 2rem;
        }

        .quick-details-list {
            width: 100%;
            display: flex;
            flex-direction: column;
            gap: 1rem;
            border-top: 1px solid var(--border-color);
            padding-top: 1.5rem;
            text-align: left;
        }

        .detail-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.875rem;
        }

        .detail-label {
            color: var(--text-muted);
            font-weight: 600;
        }

        .detail-val {
            color: var(--text-main);
            font-weight: 700;
        }

        /* Right Side: Form Cards */
        .profile-forms-column {
            display: flex;
            flex-direction: column;
            gap: 2rem;
        }

        .card {
            background-color: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: var(--border-radius);
            padding: 2rem;
            box-shadow: var(--shadow-sm);
            transition: all 0.3s ease;
        }

        .card:hover {
            border-color: var(--border-hover);
        }

        .card-header-title {
            font-size: 1.125rem;
            font-weight: 800;
            color: var(--text-main);
            margin-bottom: 1.5rem;
            border-bottom: 1px solid var(--border-color);
            padding-bottom: 0.75rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .card-header-title svg {
            width: 1.25rem;
            height: 1.25rem;
            color: var(--primary-color);
        }

        /* Form Inputs */
        .form-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 1.5rem 2rem;
            margin-bottom: 1.5rem;
        }

        .form-group {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
        }

        .form-group-full {
            grid-column: span 2;
        }

        .form-label {
            font-size: 0.875rem;
            font-weight: 700;
            color: var(--text-label);
        }

        .input-wrapper {
            position: relative;
            border-radius: 8px;
        }

        .input-field {
            display: block;
            width: 100%;
            padding: 0.75rem 1rem;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            color: var(--text-main);
            background-color: #ffffff;
            font-size: 0.875rem;
            font-family: inherit;
            transition: all 0.2s ease;
        }

        .input-field:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 2px rgba(59, 70, 241, 0.15);
        }

        .input-field:disabled {
            background-color: #f1f5f9;
            color: var(--text-muted);
            cursor: not-allowed;
        }

        /* Password visibility toggle icon */
        .eye-toggle-btn {
            position: absolute;
            right: 0.75rem;
            top: 50%;
            transform: translateY(-50%);
            border: none;
            background: none;
            color: var(--text-muted);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0.25rem;
            border-radius: 4px;
            transition: color 0.2s ease;
        }

        .eye-toggle-btn:hover {
            color: var(--text-label);
        }

        .eye-toggle-btn svg {
            width: 1.125rem;
            height: 1.125rem;
            stroke-width: 2;
        }

        .btn-submit {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0.75rem 1.5rem;
            border-radius: 8px;
            font-size: 0.875rem;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s ease;
            border: 1px solid transparent;
            background-color: var(--primary-color);
            color: #ffffff;
            box-shadow: 0 4px 6px -1px rgba(59, 70, 241, 0.1);
        }

        .btn-submit:hover {
            background-color: var(--primary-hover);
            box-shadow: 0 10px 15px -3px rgba(59, 70, 241, 0.2);
        }

        /* Alerts notifications */
        .alert-success {
            background-color: var(--color-completed-light);
            border-left: 4px solid var(--color-completed);
            padding: 1rem;
            border-radius: 8px;
            margin-bottom: 1.5rem;
            box-shadow: var(--shadow-sm);
            display: flex;
            align-items: center;
            font-size: 0.875rem;
            font-weight: 600;
            color: #065f46;
            animation: fadeIn 0.4s ease-out;
        }

        .alert-success svg {
            width: 1.25rem;
            height: 1.25rem;
            margin-right: 0.5rem;
            color: var(--color-completed);
        }

        .alert-error {
            background-color: var(--color-hold-light);
            border-left: 4px solid var(--color-hold);
            padding: 1rem;
            border-radius: 8px;
            margin-bottom: 1.5rem;
            box-shadow: var(--shadow-sm);
            display: flex;
            flex-direction: column;
            gap: 0.25rem;
            font-size: 0.875rem;
            font-weight: 600;
            color: #991b1b;
        }

        .alert-error ul {
            list-style: inside disc;
            padding-left: 0.5rem;
            font-weight: 500;
            font-size: 0.8rem;
            margin-top: 0.25rem;
        }

        /* General Animation keyframes */
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

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

        /* Responsive Layouts */
        @media (max-width: 1024px) {
            .main-content {
                margin-left: 0;
                padding: 1.5rem;
            }
            .profile-container {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 640px) {
            .form-grid {
                grid-template-columns: 1fr;
            }
            .form-group-full {
                grid-column: span 1;
            }
            .btn-submit {
                width: 100%;
            }
        }
    </style>
    <!-- Favicon -->
    <link rel="icon" type="image/png" href="{{ asset('images/faviocntaskpannel.png') }}">
</head>
<body>


    <div class="dashboard-layout">
 
        @include('admin.sidebar.sidebar')

        <main class="main-content">
            @include('admin.sidebar.topbar', ['title' => 'Profile'])

            <!-- Alerts for updates -->
            @if (session('success'))
                <div class="alert-success">
                    <svg fill="none" stroke="currentColor" stroke-width="2.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                        <path stroke-linecap="round" stroke-linejoin="round" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
                    </svg>
                    <span>{{ session('success') }}</span>
                </div>
            @endif

            @if ($errors->any())
                <div class="alert-error">
                    <strong>Please resolve the following errors:</strong>
                    <ul>
                        @foreach ($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                </div>
            @endif

            <!-- Profile Dashboard Grid -->
            <div class="profile-container">
                

                <!-- 2. Profile Details & Password Form Column (Right) -->
                <div class="profile-forms-column">
                    
                    <!-- Card 1: Account Settings Form -->
                    <div class="card">
                        <h3 class="card-header-title">
                            <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                                <path stroke-linecap="round" stroke-linejoin="round" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path>
                            </svg>
                            Account Settings
                        </h3>

                        <form method="POST" action="{{ route('profile.update') }}">
                            @csrf
                            <div class="form-grid">
                                
                                <!-- Name Input -->
                                <div class="form-group">
                                    <label for="profile_name" class="form-label">Full Name</label>
                                    <div class="input-wrapper">
                                        <input type="text" name="name" id="profile_name" class="input-field" value="{{ old('name', session('admin_name', 'Admin')) }}" required>
                                    </div>
                                </div>

                                <!-- Email Input -->
                                <div class="form-group">
                                    <label for="profile_email" class="form-label">Email Address</label>
                                    <div class="input-wrapper">
                                        <input type="email" name="email" id="profile_email" class="input-field" value="{{ old('email', session('admin_email', 'taskardhsainik@gmail.com')) }}" required>
                                    </div>
                                </div>

                                <!-- Role Input (Disabled) -->
                                <div class="form-group">
                                    <label for="profile_role" class="form-label">Role</label>
                                    <div class="input-wrapper">
                                        <input type="text" id="profile_role" class="input-field" value="Super Admin" disabled>
                                    </div>
                                </div>

                                <!-- Status Input (Disabled) -->
                                <div class="form-group">
                                    <label for="profile_status" class="form-label">Status</label>
                                    <div class="input-wrapper">
                                        <input type="text" id="profile_status" class="input-field" value="Active" disabled>
                                    </div>
                                </div>

                            </div>
                            <div style="display: flex; justify-content: flex-end;">
                                <button type="submit" class="btn-submit">Save Account Changes</button>
                            </div>
                        </form>
                    </div>

                    <!-- Card 2: Password Reset Form -->
                    <div class="card">
                        <h3 class="card-header-title">
                            <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                                <path stroke-linecap="round" stroke-linejoin="round" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path>
                            </svg>
                            Password settings
                        </h3>

                        <form method="POST" action="{{ route('profile.password.update') }}">
                            @csrf
                            <div class="form-grid">
                                
                                <!-- Current Password -->
                                <div class="form-group">
                                    <label for="current_password" class="form-label">Current Password</label>
                                    <div class="input-wrapper">
                                        <input type="password" name="current_password" id="current_password" class="input-field" required>
                                        <button type="button" class="eye-toggle-btn" onclick="togglePassVisibility('current_password', this)">
                                            <svg class="eye-open-icon" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                                                <path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"></path>
                                                <path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"></path>
                                            </svg>
                                            <svg class="eye-closed-icon" style="display: none;" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                                                <path stroke-linecap="round" stroke-linejoin="round" d="M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"></path>
                                            </svg>
                                        </button>
                                    </div>
                                </div>

                                <!-- New Password -->
                                <div class="form-group">
                                    <label for="new_password" class="form-label">New Password</label>
                                    <div class="input-wrapper">
                                        <input type="password" name="password" id="new_password" class="input-field" required>
                                        <button type="button" class="eye-toggle-btn" onclick="togglePassVisibility('new_password', this)">
                                            <svg class="eye-open-icon" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                                                <path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"></path>
                                                <path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"></path>
                                            </svg>
                                            <svg class="eye-closed-icon" style="display: none;" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                                                <path stroke-linecap="round" stroke-linejoin="round" d="M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"></path>
                                            </svg>
                                        </button>
                                    </div>
                                </div>

                                <!-- Confirm New Password -->
                                <div class="form-group">
                                    <label for="password_confirmation" class="form-label">Confirm New Password</label>
                                    <div class="input-wrapper">
                                        <input type="password" name="password_confirmation" id="password_confirmation" class="input-field" required>
                                        <button type="button" class="eye-toggle-btn" onclick="togglePassVisibility('password_confirmation', this)">
                                            <svg class="eye-open-icon" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                                                <path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"></path>
                                                <path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"></path>
                                            </svg>
                                            <svg class="eye-closed-icon" style="display: none;" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                                                <path stroke-linecap="round" stroke-linejoin="round" d="M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"></path>
                                            </svg>
                                        </button>
                                    </div>
                                </div>

                            </div>
                            
                            <div style="display: flex; justify-content: flex-end; margin-top: 1.5rem;">
                                <button type="submit" class="btn-submit">Update Password</button>
                            </div>
                        </form>
                    </div>

                </div>

            </div>

        </main>
    </div>

    <!-- Password Eye Visibility toggle script -->
    <script>
        function togglePassVisibility(id, btn) {
            const field = document.getElementById(id);
            if (!field) return;
            const openIcon = btn.querySelector('.eye-open-icon');
            const closedIcon = btn.querySelector('.eye-closed-icon');
            
            if (field.type === 'password') {
                field.type = 'text';
                if (openIcon) openIcon.style.display = 'none';
                if (closedIcon) closedIcon.style.display = 'block';
            } else {
                field.type = 'password';
                if (openIcon) openIcon.style.display = 'block';
                if (closedIcon) closedIcon.style.display = 'none';
            }
        }

        document.addEventListener('DOMContentLoaded', function() {

            // Auto hide success alerts after 3 seconds
            const successAlert = document.querySelector('.alert-success');
            if (successAlert) {
                setTimeout(() => {
                    successAlert.style.transition = 'opacity 0.5s ease';
                    successAlert.style.opacity = '0';
                    setTimeout(() => {
                        successAlert.remove();
                    }, 500);
                }, 3000);
            }
        });
    </script>
</body>
</html>
