@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #7C3AED;
    --primary-hover: #6D28D9;
    --primary-gradient: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%);
    --secondary: #10B981; 
    --secondary-hover: #059669;
    --accent: #F59E0B; 
    --dark: #0B0F19; /* Premium dark blueish */
    --dark-surface: #1E293B;
    --light: #F4F7FB; 
    --white: #FFFFFF;
    --text: #334155;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --danger: #EF4444;
    
    --radius-sm: 8px;
    --radius: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 20px 40px -10px rgba(15, 23, 42, 0.08);
    --shadow-float: 0 25px 50px -12px rgba(79, 70, 229, 0.25);
    
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
}

/* Base resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--light);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.02em;
    color: var(--dark);
}

.bg-gray {
    background: var(--light);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* Layout Utilities */
.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.flex { display: flex; }
.grid { display: grid; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }
.mt-2 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; }

/* Dashboard layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 270px;
    background: var(--dark);
    position: fixed;
    height: 100%;
    z-index: 50;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 25px rgba(0,0,0,0.05);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar .logo {
    margin-bottom: 3rem;
    padding-left: 0.5rem;
}

.sidebar .logo h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--white);
    letter-spacing: -0.05em;
}

.sidebar .logo span {
    color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
    background-image: var(--primary-gradient);
}

.nav-menu {
    list-style: none;
    flex: 1;
}

.nav-menu li {
    margin-bottom: 0.5rem;
}

.nav-menu a {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    color: #ffffff;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-menu a i {
    margin-right: 14px;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    transition: transform 0.3s ease, color 0.3s ease;
}

.nav-menu a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
    transform: translateX(5px);
}

.nav-menu a.active {
    background: var(--primary-gradient);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.nav-menu a.active i {
    color: var(--white);
}

.main-content {
    flex: 1;
    margin-left: 270px;
    padding: 3rem;
    max-width: calc(100vw - 270px);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 3.5rem;
}

.header-title h2 {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1.2;
}

.header-title p {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-top: 0.4rem;
}

/* Cards & Stats */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
    padding: 2rem;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: rgba(99, 102, 241, 0.2);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.8rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: linear-gradient(135deg, transparent 60%, rgba(79, 70, 229, 0.04) 100%);
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 70px;
    height: 70px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
}

.icon-blue { background: #EEF2FF; color: var(--primary); }
.icon-green { background: #ECFDF5; color: var(--secondary); }
.icon-orange { background: #FFFBEB; color: var(--accent); }

.stat-info h3 {
    font-size: 2.5rem;
    color: var(--dark);
    line-height: 1;
    margin-bottom: 0.4rem;
}

.stat-info p {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #F8FAFC;
    font-size: 1rem;
    color: var(--dark);
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-size: 1rem;
    gap: 10px;
    letter-spacing: 0.02em;
}

.btn-primary {
    background: var(--primary-gradient);
    color: var(--white) !important;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-float);
    color: var(--white) !important;
}

.btn-secondary {
    background: var(--white);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover, .btn-secondary:focus {
    border-color: var(--border);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.btn-secondary.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff !important;
}

.btn:active {
    transform: translateY(0);
}

/* Document Split View */
.split-view {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 3rem;
    height: calc(100vh - 160px);
}

.editor-form {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow-y: auto;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.preview-area {
    background: #E2E8F0;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
}

.doc-paper {
    background: #FFFFFF;
    width: 100%;
    max-width: 650px;
    min-height: 900px;
    padding: 3.5rem;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1), 0 5px 15px rgba(0,0,0,0.05);
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    color: #1A1A1A;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.doc-paper .doc-signature {
    margin-top: auto !important; /* Forces signature to the absolute bottom of the paper */
    padding-top: 50px;
}

/* Templates list in Editor */
.template-selector {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    margin-bottom: 25px;
    overflow-x: auto;
    padding-bottom: 12px;
    -webkit-overflow-scrolling: touch;
}

.template-selector::-webkit-scrollbar {
    height: 6px;
}
.template-selector::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05); 
    border-radius: 10px;
}
.template-selector::-webkit-scrollbar-thumb {
    background: var(--primary); 
    border-radius: 10px;
}

.template-pill {
    padding: 0.6rem 1.6rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 2rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-muted);
    box-shadow: var(--shadow-sm);
}

.template-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.template-pill.active {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

/* Modals */
.custom-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-modal-overlay.active {
    opacity: 1; visibility: visible;
}

.custom-modal-box {
    background: var(--white);
    padding: 3.5rem 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-float);
    width: 90%; max-width: 440px;
    text-align: center;
    transform: translateY(30px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.custom-modal-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 6px;
    background: var(--primary-gradient);
}

.custom-modal-overlay.active .custom-modal-box {
    transform: translateY(0) scale(1);
}

.custom-modal-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    line-height: 1;
}

.custom-modal-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.8rem;
}

.custom-modal-text {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 2.5rem;
    line-height: 1.5;
}

/* Responsive */
.mobile-menu-btn {
    display: none;
    font-size: 1.8rem;
    color: var(--dark);
    cursor: pointer;
    background: var(--white);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); width: 280px; }
    .sidebar.active { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 2rem 1.5rem; max-width: 100%; top: 0; position: relative; }
    .mobile-menu-btn { display: inline-block; }
    
    .header { gap: 1rem; align-items:center; margin-bottom: 2rem; justify-content: flex-start; flex-wrap: wrap; }
    .header-title { flex: 1 1 100%; margin-top: 10px; }
    
    .split-view { grid-template-columns: 1fr; height: auto; }
}

/* Tables */
table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}
th {
    background: #F8FAFC;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1.2rem 1rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
td {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #F8FAFC; }

.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-weight: 500;
}
.alert-danger { background: #FEF2F2; color: #991B1B; border: 1px solid #FCA5A5; border-left: 4px solid #EF4444; }
.alert-success { background: #F0FDF4; color: #166534; border: 1px solid #86EFAC; border-left: 4px solid #22C55E; }

/* Dashboard Quick links */
.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}
.quick-link-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--dark);
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}
.quick-link-btn i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
    transition: transform 0.3s ease;
}
.quick-link-btn:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-5px);
    color: var(--primary);
}
.quick-link-btn:hover i {
    transform: scale(1.1);
}

/* =========================================================================
   LOGIN & REGISTER LAYOUT
   ========================================================================= */
.login-container {
    display: flex;
    min-height: 100vh;
    background: var(--background);
    padding: 2rem;
    align-items: center;
    justify-content: center;
}

.login-left, .login-right {
    flex: 1;
}

.login-left {
    background: var(--white);
    max-width: 500px;
    padding: 4rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.login-right {
    display: none;
}

@media (min-width: 900px) {
    .login-container {
        padding: 0;
        align-items: stretch;
    }
    .login-left {
        max-width: 45%;
        border-radius: 0;
        box-shadow: 20px 0 50px rgba(0,0,0,0.05);
    }
    .login-right {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
        color: var(--white);
        padding: 4rem;
        position: relative;
        overflow: hidden;
    }
    .login-right::before {
        content: '';
        position: absolute;
        width: 150%; height: 150%;
        background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
        top: -25%; left: -25%;
    }
}

.login-left .logo {
    margin-bottom: 2rem;
    text-align: left;
}

.login-left .logo h1 {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 0.5rem;
    font-family: 'Outfit', sans-serif;
}

.login-left .logo span {
    color: var(--primary);
}

.login-left .logo p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.login-left .form-group {
    margin-bottom: 1.5rem;
}

.login-left .btn-block {
    width: 100%;
    margin-top: 1rem;
    padding: 1rem;
    font-size: 1.1rem;
}

.login-left a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.login-left a:hover {
    color: var(--dark);
}

.login-right .glass-module {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    padding: 3rem;
    max-width: 500px;
    position: relative;
    z-index: 10;
}

.login-right h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    line-height: 1.2;
    font-family: 'Outfit', sans-serif;
}

.login-right ul {
    list-style: none;
    padding: 0;
}

.login-right ul li {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 15px;
}
