/* =========================================
   Tally CRM - Clean Blue & Smooth Design
   ========================================= */

/* 1. RESET & VARIABLES */
:root {
    --primary-color: #2563eb;
    /* Royal Blue */
    --primary: #2563eb;
    --primary-dark: #1e3a8a;

    --primary-light: #eff6ff;
    /* Soft Blue */
    --secondary-color: #64748b;
    /* Slate Gray */
    --success-color: #10b981;
    /* Emerald */
    --info-color: #0ea5e9;
    /* Sky */
    --warning-color: #f59e0b;
    /* Amber */
    --danger-color: #ef4444;
    /* Red */
    --light-color: #f8fafc;
    /* Slate 50 */
    --dark-color: #1e293b;
    /* Slate 800 */

    --body-bg: #eff6ff;
    /* Very Light Blue Tint - Clean & Fresh */
    --text-color: #334155;
    /* Slate 700 */
    --border-color: #e2e8f0;
    /* Slate 200 */

    --sidebar-width: 260px;
    --sidebar-bg: #1e3a8a;
    /* Deep Blue Sidebar */
    --sidebar-text: #e2e8f0;
    /* Light Gray Text */
    --header-height: 70px;
    --transition-speed: 0.3s;

    --card-radius: 16px;
    --btn-radius: 10px;
    --shadow-sm: 0 1px 3px 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.025);
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
    background-color: var(--body-bg);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    font-size: 1rem;
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.2s;
}

a:hover {
    color: #1e40af;
    /* Deep Blue Hover */
}

/* 2. LAYOUT STYLES */

/* Sidebar */
/* Sidebar - Pure Professional Black Theme */
.sidebar-wrapper {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: #111827;
    /* Gray 900 - Almost Black */
    color: #f3f4f6;
    /* Gray 100 */
    transition: all var(--transition-speed);
    z-index: 1000;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-wrapper::-webkit-scrollbar {
    display: none;
}

.sidebar-wrapper.collapsed {
    width: 80px;
}

.sidebar-header {
    padding: 24px;
    background-color: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    /* Slightly more visible border */
    text-align: center;
}

.sidebar-header h3 {
    color: #ffffff;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.sidebar-header p {
    color: #9ca3af;
    /* Gray 400 */
}

/* Sidebar Menu - Pure Professional Black Theme */
.sidebar-menu {
    list-style: none;
    padding: 16px;
    margin: 0;
}

.sidebar-menu li {
    border-bottom: none;
    margin-bottom: 4px;
}

.sidebar-menu a {
    display: flex;
    padding: 12px 16px;
    color: #d1d5db;
    /* Gray 300 */
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
    align-items: center;
    border-radius: 8px;
}

.sidebar-menu a:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    /* Semi-transparent Hover */
    color: #ffffff !important;
    transform: translateX(5px);
    box-shadow: none;
}

.sidebar-menu a.active {
    background-color: #ffffff !important;
    /* Pure White Active Background */
    color: #1e3a8a !important;
    /* Deep Blue Text */
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    /* Soft shadow */
    border-left: 5px solid #60a5fa;
    /* Blue Accent Border */
    padding-left: 14px;
    border-radius: 8px;
}

.sidebar-menu i {
    margin-right: 12px;
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-wrapper.collapsed .sidebar-menu {
    padding: 16px 8px;
}

.sidebar-wrapper.collapsed .sidebar-menu span.menu-text {
    display: none;
}

.sidebar-wrapper.collapsed .sidebar-menu a {
    justify-content: center;
    padding: 12px;
}

.sidebar-wrapper.collapsed .sidebar-menu i {
    margin-right: 0;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    transition: all var(--transition-speed);
    padding: 0;
    /* Removing padding from container to let header stretch */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content.expanded {
    margin-left: 80px;
}

/* Top Header - Transparent & Unified */
.top-header {
    background-color: rgba(239, 246, 255, 0.9);
    /* Translucent background */
    backdrop-filter: blur(10px);
    /* Blur effect */
    padding: 20px 32px;
    /* Increased padding */
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    /* Subtle border */
    margin-bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    /* Subtle shadow */
    position: sticky;
    /* Sticky position */
    top: 0;
    z-index: 900;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    padding: 0;
    display: none;
}

/* 3. COMPONENTS */

/* Cards - Smooth & Clean */
.card {
    background-color: #fff;
    border: none;
    border-radius: var(--card-radius);
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 20px 24px;
    font-weight: 700;
    color: var(--text-color);
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    background-color: transparent;
    border-top: 1px solid var(--border-color);
}

/* Stats Cards */
.stat-card {
    display: flex;
    align-items: center;
    padding: 24px;
}

.stat-icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-right: 20px;
    color: #fff;
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.1);
}

.stat-content h3 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.stat-content p {
    margin: 0;
    color: var(--secondary-color);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Buttons */
.btn {
    border-radius: var(--btn-radius);
    padding: 0.6rem 1.25rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background-color: #1d4ed8;
    color: #fff;
}

.btn-success {
    background-color: var(--success-color);
    color: #fff;
}

.btn-danger {
    background-color: var(--danger-color);
    color: #fff;
}

.btn-warning {
    background-color: var(--warning-color);
    color: #fff;
}

.btn-info {
    background-color: var(--info-color);
    color: #fff;
}

/* Forms */
.form-control,
.form-select {
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    padding: 0.6rem 1rem;
    box-shadow: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Tables */
.table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: collapse;
}

.table th {
    background-color: #f8fafc;
    color: var(--secondary-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 16px 20px;
    border-bottom: 2px solid var(--border-color);
    border-top: none;
}

.table td {
    padding: 16px 20px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}

/* Badges */
.badge {
    padding: 0.5em 0.8em;
    font-size: 0.75em;
    font-weight: 700;
    border-radius: 20px;
}

.bg-success {
    background-color: #dcfce7 !important;
    color: #166534 !important;
}

.bg-danger {
    background-color: #fee2e2 !important;
    color: #991b1b !important;
}

.bg-warning {
    background-color: #fef3c7 !important;
    color: #92400e !important;
}

.bg-primary {
    background-color: #eff6ff !important;
    color: #1e40af !important;
}

/* Empty State Illustration */
.empty-state-icon {
    width: 120px;
    height: 120px;
    background-color: var(--body-bg);
    /* Use soft blue bg */
    border-radius: 24px;
    /* Changed to clean box */
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 3rem;
    color: var(--success-color);
    /* Green for 'Fully Paid' */
    box-shadow: var(--shadow-md);
    position: relative;
    border: 4px solid #fff;
}

/* Simple animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease-out forwards;
}

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar-wrapper {
        margin-left: -260px;
    }

    .sidebar-wrapper.mobile-open {
        margin-left: 0;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .sidebar-toggle {
        display: inline-block;
    }

    .table thead,
    .table-modern thead {
        display: none;
    }

    .table,
    .table-modern,
    .table tbody,
    .table-modern tbody,
    .table tr,
    .table-modern tr,
    .table td,
    .table-modern td {
        display: block;
        width: 100%;
    }

    .table tr,
    .table-modern tr {
        margin-bottom: 16px;
        background: #fff;
        border: 1px solid var(--border-color);
        border-radius: 12px;
        overflow: hidden;
    }

    .table td,
    .table-modern td {
        display: flex;
        justify-content: space-between;
        text-align: right;
        border-bottom: 1px solid #f1f5f9;
        padding: 12px 16px;
    }

    .table td::before,
    .table-modern td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--secondary-color);
        font-size: 0.8rem;
    }
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid #fff;
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 420px;
    z-index: 1;
}

/* Background Shapes for Login */
.bg-shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.15;
    z-index: 0;
    filter: blur(50px);
}

.bg-shape-1 {
    width: 300px;
    height: 300px;
    background: var(--primary-color);
    top: -50px;
    left: -50px;
    animation: floatShape 10s infinite ease-in-out;
}

.bg-shape-2 {
    width: 250px;
    height: 250px;
    background: var(--info-color);
    bottom: -50px;
    right: -50px;
    animation: floatShape 15s infinite ease-in-out reverse;
}

/* Avatar Box (Clean Box Display) */
.avatar-box {
    border-radius: 8px;
    /* Rounded box */
    object-fit: cover;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    /* Slight shadow for clean box */
    border: 1px solid rgba(0, 0, 0, 0.05);
    background-color: #fff;
    transition: transform 0.2s;
    overflow: hidden;
}

.avatar-box:hover {
    transform: scale(1.05);
}

.avatar-box-sm {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    /* Rounded box */
    font-weight: 600;
}

/* Placeholder Icon Box */
.placeholder-icon-box {
    width: 80px;
    height: 80px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    border-radius: 16px;
    /* Box */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #edf2f7;
}

/* Modern Table Styles */
.table-modern {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0;
}

.table-modern thead th {
    background-color: #f8fafc;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    padding: 16px 24px;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.table-modern tbody td {
    padding: 16px 24px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-size: 0.9rem;
}

.table-modern tbody tr:last-child td {
    border-bottom: none;
}

.table-modern tbody tr {
    transition: background-color 0.2s ease;
}

.table-modern tbody tr:hover {
    background-color: #f8fafc;
}

/* Fix for modern btn small size */
.btn-modern.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
    border-radius: 8px;
}

/* Modern Badges with Dark Text for Readability */
.badge-modern.badge-success,
.badge-modern.bg-success {
    background-color: #dcfce7 !important;
    color: #14532d !important;
    /* Dark Green Text */
    border: 1px solid #bbf7d0;
}

.badge-modern.badge-info,
.badge-modern.bg-info {
    background-color: #e0f2fe !important;
    color: #0c4a6e !important;
    /* Dark Blue Text */
    border: 1px solid #bae6fd;
}

.badge-modern.badge-warning,
.badge-modern.bg-warning {
    background-color: #fef9c3 !important;
    color: #713f12 !important;
    /* Dark Brown Text */
    border: 1px solid #fde047;
}

.badge-modern.badge-danger,
.badge-modern.bg-danger {
    background-color: #fee2e2 !important;
    color: #991b1b !important;
    /* Dark Red Text */
    border: 1px solid #fecaca;
}

/* Modern Card Styles (White Box) */
.card-modern {
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header-modern {
    padding: 1.25rem 1.5rem;
    background-color: #fff;
    border-bottom: 1px solid #f1f5f9;
    font-weight: 600;
}

.card-body-modern {
    padding: 1.5rem;
}

@keyframes floatShape {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    50% {
        transform: translate(30px, 30px) rotate(10deg);
    }

    100% {
        transform: translate(0, 0) rotate(0deg);
    }
}

/* Modern Form Controls */
.form-label-modern {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    display: block;
    letter-spacing: 0.3px;
}

.form-control-modern {
    display: block;
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-color);
    background-color: #f8fafc;
    background-clip: padding-box;
    border: 2px solid transparent;
    border-radius: 12px;
    transition: all 0.2s ease-in-out;
}

.form-control-modern:focus {
    color: var(--text-color);
    background-color: #fff;
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Modern Button */
.btn-modern {
    display: inline-block;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    border-radius: 12px;
    transition: all 0.2s ease-in-out;
    letter-spacing: 0.5px;
}

.btn-primary-modern {
    color: #fff;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1d4ed8 100%);
    border: none;
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

.btn-primary-modern:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 15px 20px -3px rgba(37, 99, 235, 0.4);
}

.btn-primary-modern:active {
    transform: translateY(0);
}

.btn-outline-modern {
    color: var(--secondary-color);
    background-color: transparent;
    border: 1px solid var(--border-color);
}

.btn-outline-modern:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background-color: #fff;
}

/* Modern Badge */
.badge-modern {
    padding: 0.5em 0.8em;
    font-size: 0.75em;
    font-weight: 600;
    border-radius: 6px;
    letter-spacing: 0.3px;
}


/* Fix for icons in input groups */
.position-relative .fa-user,
.position-relative .fa-lock {
    color: #94a3b8;
    transition: color 0.2s;
}

.form-control-modern:focus+.position-absolute i,
.position-relative:focus-within .fa-user,
.position-relative:focus-within .fa-lock {
    color: var(--primary-color);
}

/* Login Icon Wrapper */
.login-icon-wrapper {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    color: white;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
    transition: transform 0.3s ease;
}

.login-icon-wrapper:hover {
    transform: scale(1.05) rotate(5deg);
}

/* Fix for modern inputs inside input-groups */
.input-group>.form-control-modern {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Ensure addon styles match modern inputs */
.input-group-text {
    border: 2px solid transparent;
    background-color: #f8fafc;
    /* Match form-control-modern bg */
    border-right: none;
    border-radius: 12px 0 0 12px;
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    color: var(--secondary-color);
}