@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --primary-gradient: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;

    --bg-body: #f0f2f5;
    --bg-sidebar: #1e293b;
    --bg-card: #ffffff;
    --bg-input: #f8fafc;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-white: #ffffff;

    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --sidebar-width: 260px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== LOGIN PAGE V2 - Premium Redesign ===== */
.login-page-v2 {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-bg-shapes {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.login-bg-shapes .shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.08;
    animation: floatShape 20s infinite ease-in-out;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    top: -100px;
    left: -100px;
    animation-delay: 0s !important;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #06b6d4, #2563eb);
    top: 50%;
    right: -80px;
    animation-delay: -5s !important;
    animation-duration: 25s !important;
}

.shape-3 {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    bottom: -50px;
    left: 30%;
    animation-delay: -10s !important;
    animation-duration: 18s !important;
}

.shape-4 {
    width: 150px;
    height: 150px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    top: 20%;
    right: 20%;
    animation-delay: -7s !important;
    animation-duration: 22s !important;
}

.shape-5 {
    width: 250px;
    height: 250px;
    background: linear-gradient(135deg, #10b981, #06b6d4);
    bottom: 10%;
    left: 5%;
    animation-delay: -12s !important;
    animation-duration: 30s !important;
}

@keyframes floatShape {

    0%,
    100% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }

    25% {
        transform: translate(30px, -40px) scale(1.1) rotate(5deg);
    }

    50% {
        transform: translate(-20px, 20px) scale(0.95) rotate(-3deg);
    }

    75% {
        transform: translate(15px, 30px) scale(1.05) rotate(3deg);
    }
}

.login-container {
    display: flex;
    width: 100%;
    max-width: 960px;
    min-height: 580px;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.6s ease;
}

.login-branding {
    flex: 1;
    background: var(--primary-gradient);
    padding: 48px 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-branding::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.login-branding-content {
    position: relative;
    z-index: 1;
    color: white;
    text-align: center;
}

.login-branding-logo {
    width: 88px;
    height: 88px;
    margin: 0 auto 24px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: pulse-glow 3s infinite ease-in-out;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    }

    50% {
        box-shadow: 0 0 40px rgba(255, 255, 255, 0.2);
    }
}

.login-branding-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.login-branding-content h1 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.login-branding-content p {
    font-size: 14px;
    opacity: 0.8;
    margin-bottom: 36px;
}

.login-branding-features {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition);
}

.login-feature:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateX(4px);
}

.login-feature svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.login-form-panel {
    flex: 1;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
}

.login-form-wrapper {
    width: 100%;
    max-width: 340px;
}

.login-form-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-form-avatar {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #eff6ff, #e0e7ff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-form-avatar svg {
    width: 28px;
    height: 28px;
    color: var(--primary);
}

.login-form-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.login-form-header p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrapper>svg:first-child {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.input-icon-wrapper .form-control {
    padding-left: 42px;
    padding-right: 42px;
}

.password-toggle {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: var(--transition);
}

.password-toggle:hover {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
}

.password-toggle svg {
    width: 18px;
    height: 18px;
}

.login-btn {
    margin-top: 8px;
    position: relative;
    overflow: hidden;
}

.login-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.login-btn:hover::after {
    width: 300px;
    height: 300px;
}

.login-footer {
    text-align: center;
    margin-top: 28px;
}

.login-footer a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--primary);
    font-weight: 500;
    transition: var(--transition);
}

.login-footer a:hover {
    gap: 10px;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-8px);
    }

    40% {
        transform: translateX(8px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }
}

/* Legacy login support */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.5s ease;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.login-logo p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-input);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: white;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
}

.form-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-check label {
    font-size: 14px;
    cursor: pointer;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-secondary {
    background: var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-sm svg {
    width: 16px;
    height: 16px;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 16px;
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 8px;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.admin-sidebar .sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-sidebar .sidebar-brand-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.admin-sidebar .sidebar-brand h2 {
    font-size: 14px;
    font-weight: 700;
    color: white;
}

.admin-sidebar .sidebar-brand span {
    font-size: 11px;
    color: var(--text-muted);
}

.admin-sidebar .nav-section {
    padding: 16px 12px 8px;
}

.admin-sidebar .nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
}

.admin-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
}

.admin-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.admin-sidebar .nav-link.active {
    background: var(--primary);
    color: white;
}

.admin-sidebar .nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.admin-topbar h1 {
    font-size: 20px;
    font-weight: 700;
}

.admin-topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.admin-user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
}

.admin-content {
    padding: 24px 32px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 24px;
    border: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.stat-card-icon.blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.stat-card-icon.green {
    background: linear-gradient(135deg, #34d399, #10b981);
}

.stat-card-icon.purple {
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
}

.stat-card-icon.orange {
    background: linear-gradient(135deg, #fb923c, #f97316);
}

.stat-card-info h3 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 16px;
    font-weight: 700;
}

.card-body {
    padding: 24px;
}

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-input);
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: rgba(37, 99, 235, 0.02);
}

.table-app-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-app-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #eff6ff, #e0e7ff);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.table-app-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.table-app-icon svg {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #e0e7ff;
    color: #3730a3;
}

.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeInUp 0.3s ease;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.tags-input-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    min-height: 48px;
    cursor: text;
    transition: var(--transition);
}

.tags-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: white;
}

.tags-input-wrapper .tag-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--primary);
    color: white;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}

.tags-input-wrapper .tag-item .tag-remove {
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    opacity: 0.7;
    background: none;
    border: none;
    color: white;
    padding: 0;
}

.tags-input-wrapper .tag-item .tag-remove:hover {
    opacity: 1;
}

.tags-input-wrapper input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    font-family: inherit;
    flex: 1;
    min-width: 120px;
    padding: 4px 0;
    color: var(--text-primary);
}

.icon-preview {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    border: 2px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
    overflow: hidden;
    background: var(--bg-input);
}

.icon-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

    .admin-topbar,
    .admin-content {
        padding-left: 16px;
        padding-right: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .login-container {
        flex-direction: column;
        min-height: auto;
        max-width: 480px;
    }

    .login-branding {
        padding: 32px 24px;
    }

    .login-branding-features {
        display: none;
    }

    .login-form-panel {
        padding: 32px 24px;
    }
}

@media (max-width: 480px) {
    .login-branding {
        display: none;
    }

    .login-page-v2 {
        background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    }

    .login-form-panel {
        border-radius: 16px;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Change Password Modal ===== */
.cp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.cp-modal {
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.3s ease;
}

.cp-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.cp-modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.cp-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-input);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: var(--transition);
}

.cp-modal-close:hover {
    background: var(--danger);
    color: white;
}