/* 
    DocuGen Pro - Modern Dashboard Styles 
    Aesthetic: Premium, Glassmorphic, Bento-style
*/

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

:root {
    --bento-gap: 1.5rem;
    --bento-radius: 24px;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Modern Palette Refinement */
    --p-600: #2563eb;
    --p-500: #3b82f6;
    --p-400: #60a5fa;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --glass-grad: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.8) 100%);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

body {
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
.brand-text {
    font-family: var(--font-heading);
}

/* Dashboard Container Refinement */
.dashboard-container {
    max-width: 1600px !important;
    background: transparent !important;
    backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
    margin-top: 1rem !important;
}

.main-content {
    padding: 1rem !important;
}

/* Bento Grid System */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(160px, auto);
    gap: var(--bento-gap);
    width: 100%;
}

.bento-item {
    background: var(--glass-grad);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--bento-radius);
    padding: 1.75rem;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    flex-direction: column;
}

.bento-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.1), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    /* Allow clicks to pass through to buttons */
}

.bento-item:hover {
    transform: translateY(-8px) scale(1.01);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
}

.bento-item:hover::before {
    opacity: 1;
}

/* Specific Placements */
.bento-hero {
    grid-column: span 3;
    grid-row: span 2;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(255, 255, 255, 0.03) 100%);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.bento-tokens {
    grid-column: span 1;
    grid-row: span 1;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(255, 255, 255, 0.03) 100%);
}

.bento-analytics {
    grid-column: span 2;
    grid-row: span 2;
}

.bento-toolkit {
    grid-column: span 2;
    grid-row: span 1;
}

.bento-quick-start {
    grid-column: span 4;
}

.bento-recent {
    grid-column: span 4;
    min-height: 400px;
}

/* Component Styling for Bento */
.hero-content {
    max-width: 60%;
    position: relative;
    z-index: 5;
    /* Ensure content is above pseudo-elements */
}

.hero-content h1 {
    font-size: 2.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    position: relative;
    z-index: 10;
    /* Ensure buttons are above any overlays */
}

.hero-visual {
    width: 35%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.floating-icon {
    font-size: 5rem;
    filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.5));
    animation: float 6s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

/* Token Mini Widget */
.token-balance-large {
    font-size: 2.5rem;
    font-weight: 700;
    color: #f59e0b;
    margin: 0.5rem 0;
}

/* Analytics Stats */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    height: 100%;
}

.stat-box {
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

/* Section Headlines */
.bento-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Mobile Responsiveness */
@media (max-width: 1200px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bento-hero {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }

    .bento-hero,
    .bento-tokens,
    .bento-analytics,
    .bento-toolkit,
    .bento-quick-start,
    .bento-recent {
        grid-column: span 1;
    }

    .bento-hero {
        flex-direction: column;
        text-align: center;
    }

    .hero-content {
        max-width: 100%;
    }
}

/* Sidebar & Nav Refinements */
.dashboard-nav {
    background: rgba(15, 23, 42, 0.8) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-bottom: 1px solid var(--glass-border) !important;
}

.sidebar {
    background: transparent !important;
    border-right: 1px solid var(--glass-border) !important;
}

.sidebar-section h3 {
    font-size: 0.8rem !important;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.5) !important;
    border-bottom: none !important;
    margin: 2rem 0 1rem 0.5rem !important;
    font-weight: 700 !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Sidebar Links as Cards (Indigo & Slate Theme) */
.doc-link,
.action-menu a,
.sidebar-section .company-selector select {
    background: var(--slate-800) !important;
    border: 1px solid var(--glass-border) !important;
    padding: 0.85rem 1.25rem !important;
    margin-bottom: 0.75rem !important;
    font-size: 0.95rem !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    color: #ffffff !important;
    border-radius: 16px !important;
    display: flex !important;
    align-items: center !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}

.doc-link:hover,
.action-menu a:hover {
    background: rgba(59, 130, 246, 0.2) !important;
    border-color: var(--p-400) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2) !important;
    color: #ffffff !important;
}

.doc-link.active,
.featured-action a {
    background: linear-gradient(135deg, var(--p-600) 0%, var(--p-500) 100%) !important;
    border-color: var(--p-400) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4) !important;
}

.doc-icon,
.action-icon,
.featured-icon {
    font-size: 1.25rem !important;
    margin-right: 1rem !important;
    opacity: 1 !important;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Specific Adjustments for Featured Actions */
.featured-action-content {
    display: flex;
    align-items: center;
    width: 100%;
}

.featured-text {
    display: flex;
    flex-direction: column;
    margin-right: auto;
}

.featured-text strong {
    font-size: 0.95rem;
    line-height: 1.2;
}

.featured-text small {
    font-size: 0.75rem;
    opacity: 0.8;
}

.importance-badge,
.priority-badge,
.company-status {
    font-size: 0.65rem !important;
    padding: 0.25rem 0.6rem !important;
    border-radius: 20px !important;
    font-weight: 800 !important;
    letter-spacing: 0.05em !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    text-transform: uppercase;
}

/* Company Selector Specific Styling */
.sidebar-section .company-selector select {
    width: calc(100% - 1rem) !important;
    margin: 0.5rem !important;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 36px !important;
}

/* Notice/Tip boxes refinement */
.setup-notice,
.signature-importance-notice,
.client-importance-notice {
    background: rgba(59, 130, 246, 0.1) !important;
    border: 1px dashed rgba(59, 130, 246, 0.3) !important;
    border-radius: 16px !important;
    padding: 1.25rem !important;
    margin: 1rem 0.5rem !important;
    color: #cbd5e1 !important;
    font-size: 0.85rem !important;
    line-height: 1.5 !important;
}

/* Scrollbar Refinement */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Company Management Modal Styles */
.company-form {
    padding: 0.5rem;
}

.form-tabs {
    display: flex;
    overflow-x: auto;
    gap: 0.75rem;
    padding: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    scrollbar-width: none;
}

.form-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 0.6rem 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: var(--p-600);
    color: white;
    border-color: var(--p-400);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.4) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px !important;
    padding: 0.75rem 1rem !important;
    color: white !important;
    font-size: 0.9rem !important;
    transition: all 0.3s ease;
}

.form-group select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 36px !important;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--p-400) !important;
    background: rgba(15, 23, 42, 0.6) !important;
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.btn-danger-mini {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger-mini:hover {
    background: #ef4444;
    color: white;
}

.btn-secondary-mini {
    padding: 0.4rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed var(--glass-border);
    border-radius: 8px;
    color: var(--p-400);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 0.5rem;
}

.btn-secondary-mini:hover {
    background: rgba(59, 130, 246, 0.1);
    border-style: solid;
}

.form-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   LIGHT MODE: BENTO CARD BACKGROUNDS
   ======================================== */

/* Light mode bento items need solid backgrounds for text visibility */
body.light-theme .bento-item {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
    border: 1px solid rgba(79, 70, 229, 0.15) !important;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.08) !important;
}

body.light-theme .bento-item:hover {
    border-color: rgba(79, 70, 229, 0.3) !important;
    box-shadow: 0 12px 32px rgba(79, 70, 229, 0.15) !important;
}

/* Hero Bento - Light gradient with blue accent */
body.light-theme .bento-hero {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #f8fafc 100%) !important;
    border: 1px solid rgba(59, 130, 246, 0.2) !important;
}

/* Token Bento - Amber/Gold gradient for token theme */
body.light-theme .bento-tokens {
    background: linear-gradient(135deg, #451a03 0%, #78350f 50%, #92400e 100%) !important;
    border: 1px solid rgba(245, 158, 11, 0.4) !important;
}

/* Analytics Bento - Clean white with subtle blue */
body.light-theme .bento-analytics {
    background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%) !important;
    border: 1px solid rgba(59, 130, 246, 0.15) !important;
}

body.light-theme .bento-analytics .stat-box {
    background: rgba(59, 130, 246, 0.08) !important;
    border: 1px solid rgba(59, 130, 246, 0.15) !important;
}

/* Floating Tip of the Day Styles */
.floating-tip-card {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 320px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    transform: translateY(100px) scale(0.95);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    font-family: var(--font-body);
}

.floating-tip-card.visible {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Light mode override */
body.light-theme .floating-tip-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}

/* Glow effect */
.tip-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.15), transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.tip-content {
    position: relative;
    z-index: 2;
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.tip-icon-wrapper {
    flex-shrink: 0;
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--p-500), var(--p-600));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3);
}

.tip-text-content {
    flex: 1;
}

.tip-header {
    margin-bottom: 6px;
}

.tip-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--p-400);
    font-weight: 700;
    margin-bottom: 2px;
}

body.light-theme .tip-label {
    color: var(--p-600);
}

.tip-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    margin: 0;
    line-height: 1.2;
}

body.light-theme .tip-title {
    color: var(--slate-900);
}

.tip-body {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #94a3b8;
    margin: 0;
}

body.light-theme .tip-body {
    color: #475569;
}

.tip-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #64748b;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.tip-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

body.light-theme .tip-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #0f172a;
}

.tip-actions {
    margin-top: 15px;
    display: flex;
    justify-content: flex-end;
    position: relative;
    z-index: 2;
}

.tip-action-btn {
    background: transparent;
    border: none;
    color: var(--p-400);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 6px;
    transition: all 0.2s;
}

body.light-theme .tip-action-btn {
    color: var(--p-600);
}

.tip-action-btn:hover {
    background: rgba(59, 130, 246, 0.1);
}

@media (max-width: 768px) {
    .floating-tip-card {
        bottom: 20px;
        left: 20px;
        right: 20px;
        width: auto;
    }
}

/* Modern Processing Modal */
.processing-modal {
    max-width: 380px !important;
    /* Override default modal width */
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px 30px !important;
    text-align: center;
    color: white;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.6);
    position: relative;
    overflow: hidden;
}

.processing-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top, rgba(59, 130, 246, 0.1), transparent 60%);
    pointer-events: none;
}

.processing-spinner-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
}

.spinner-modern {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #3b82f6;
    border-right-color: #8b5cf6;
    animation: spinner-spin 1s linear infinite;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.spinner-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    animation: pulse 2s infinite ease-in-out;
}

.processing-modal h2 {
    font-size: 1.5rem !important;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    font-weight: 700;
}

.processing-amount {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 1rem 0;
    color: #fff;
    letter-spacing: -0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.processing-amount .currency {
    font-size: 1.5rem;
    color: #94a3b8;
    font-weight: 500;
    margin-top: 6px;
}

.processing-method {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 2.5rem;
    font-weight: 500;
}

.processing-steps {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 2rem;
}

.step {
    font-size: 0.75rem;
    color: #475569;
    position: relative;
    padding-left: 14px;
    transition: all 0.3s ease;
}

.step::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #334155;
    transition: all 0.3s ease;
}

.step.active {
    color: #3b82f6;
    font-weight: 600;
}

.step.active::before {
    background: #3b82f6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
    transform: translateY(-50%) scale(1.2);
}

.step.completed {
    color: #10b981;
}

.step.completed::before {
    background: #10b981;
}

.processing-note {
    color: #64748b;
    font-size: 0.8rem;
    line-height: 1.5;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 15px;
}

.note-icon {
    display: inline-block;
    margin-right: 4px;
}

@keyframes spinner-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Light Theme Overrides */
body.light-theme .processing-modal {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.2);
}

body.light-theme .processing-modal h2 {
    background: none;
    -webkit-text-fill-color: #0f172a;
    color: #0f172a;
}

body.light-theme .processing-amount {
    color: #0f172a;
}

body.light-theme .processing-amount .currency {
    color: #64748b;
}

body.light-theme .spinner-modern {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: #3b82f6;
}

body.light-theme .step.active {
    color: #2563eb;
}

body.light-theme .processing-note {
    border-top-color: rgba(0, 0, 0, 0.05);
}