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

html {
    background-color: var(--bg-main);
    overflow-x: hidden !important;
    max-width: 100% !important;
    width: 100% !important;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden !important;
    max-width: 100% !important;
    width: 100% !important;
    position: relative;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, .font-heading {
    font-family: var(--font-heading);
    color: var(--text-pure);
    font-weight: 700;
    letter-spacing: -0.02em;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: var(--transition-standard);
}

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

/* Crafted Inputs, Textareas & Selects */
input[type="text"]:not(.members-search):not(.has-custom-padding),
input[type="number"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
    background: var(--bg-card-solid) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: var(--border-radius-sm) !important;
    color: var(--text-main) !important;
    padding: 10px 14px;
    font-size: 0.85rem !important;
    outline: none !important;
    transition: var(--transition-standard) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    -webkit-appearance: none;
    appearance: none;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    padding-right: 36px !important;
    cursor: pointer;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
select:focus,
textarea:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15) !important;
}

/* =============================================================================
   Screen 1: Global Rounding System for All Cards & Containers Site-Wide
   ============================================================================= */
.card,
.stat-card,
.dash-card,
.dash-tile,
.neo-card,
.widget-card,
.table-card,
.panel-card,
.config-section-card,
.bento-card,
.console-container,
.dev-shell-container,
.tech-shortcuts-card,
.telemetry-card,
.doc-item-card,
.document-card,
.empty-category-card,
.box-card,
.panel-box,
.achievement-card,
.summary-card,
.goal-card {
    border-radius: var(--border-radius-lg) !important;
    overflow: hidden;
}

.btn-shortcut,
.snippet-item,
.sub-tab-btn,
.members-filter-btn {
    border-radius: var(--border-radius-md) !important;
}

/* Global protection against hover transform clipping on card containers site-wide */
.bento-grid,
.dashboard-grid,
.stats-grid,
.cards-grid,
.grid-container,
.documents-grid-wrapper,
.category-section-content {
    overflow: visible;
}

/* =============================================================================
   Screen 3: Unified Site-Wide Modal & Pop-up System
   ============================================================================= */
.modal-overlay,
.documents-modal-overlay,
.calendar-modal-overlay,
.aurora-modal-overlay,
.premium-modal-overlay,
.login-modal-overlay,
.modal-backdrop,
.modal {
    background: rgba(8, 9, 13, 0.82) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
}

.modal-content,
.documents-modal,
.calendar-modal-content,
.aurora-modal,
.premium-modal-content,
.viewer-modal-container {
    background: var(--bg-card-solid) !important;
    border: 1px solid var(--border-bright) !important;
    border-radius: 20px !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65), 0 0 40px rgba(99, 102, 241, 0.08) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    color: var(--text-main) !important;
}

.modal-header,
.documents-modal-header,
.calendar-modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    padding: 18px 24px !important;
    background: rgba(255, 255, 255, 0.02) !important;
}

.modal-header h2,
.modal-header h3,
.documents-modal-header h3,
.calendar-modal-header h3 {
    font-family: var(--font-heading) !important;
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    color: var(--text-pure) !important;
}

.modal-close-btn,
.close-modal-btn,
.documents-modal-header .modal-close-btn {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    color: var(--text-muted) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: var(--transition-standard) !important;
}

.modal-close-btn:hover,
.close-modal-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: var(--text-pure) !important;
}

/* Custom Scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-primary-glow) var(--bg-main);
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary-glow);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
    box-shadow: 0 0 8px var(--color-primary);
}

/* Chronos-Deck Buttons (Clean Matte V2) */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition-standard);
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    overflow: hidden;
}

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

.btn-primary:hover {
    background: #4752c4; /* Slightly darker elegant blue */
    color: #ffffff !important;
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    backdrop-filter: var(--glass-blur);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-bright);
    color: #ffffff !important;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--color-accent);
    color: #ffffff !important;
}

.btn-danger:hover {
    background: #e11d48;
    color: #ffffff !important;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
    border-radius: 6px;
}

/* Discordmentions & Markdown */
.discord-mention {
    color: #c9cdfb !important;
    background: rgba(88, 101, 242, 0.3) !important;
    padding: 0 4px !important;
    border-radius: 3px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: background 0.1s ease, color 0.1s ease !important;
    display: inline-block !important;
}

.discord-mention:hover {
    color: #ffffff !important;
    background: #5865F2 !important;
}

.discord-embeds-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    width: 100%;
}

.discord-embed {
    background: #2b2d31 !important;
    border-left: 4px solid #5865F2;
    border-radius: 4px !important;
    padding: 12px 16px !important;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    width: 100%;
}

.discord-embed-author {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff !important;
}

.discord-embed-author-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.discord-embed-title {
    color: #ffffff !important;
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.375;
}

.discord-embed-description {
    color: #dbdee1 !important;
    font-size: 0.875rem;
    line-height: 1.375;
    word-break: break-word;
    white-space: pre-wrap;
}

.discord-embed-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 4px;
}

.discord-embed-field {
    font-size: 0.85rem;
}

.discord-embed-field.inline {
    grid-column: span 1;
}

.discord-embed-field:not(.inline) {
    grid-column: 1 / -1;
}

.discord-embed-field-name {
    color: #ffffff !important;
    font-weight: 600;
    margin-bottom: 2px;
}

.discord-embed-field-value {
    color: #dbdee1 !important;
    white-space: pre-wrap;
}

.discord-embed-footer {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #949ba4 !important;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 4px;
}

.discord-embed-footer-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

/* Helper Utilities */
.d-flex { display: flex !important; }
.flex-column { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.align-center { align-items: center !important; }
.align-end { align-items: flex-end !important; }
.justify-between { justify-content: space-between !important; }
.justify-center { justify-content: center !important; }
.gap-4 { gap: 4px !important; }
.gap-8 { gap: 8px !important; }
.gap-10 { gap: 10px !important; }
.gap-12 { gap: 12px !important; }
.gap-15 { gap: 15px !important; }
.gap-20 { gap: 20px !important; }
.gap-24 { gap: 24px !important; }

.mb-8 { margin-bottom: 8px !important; }
.mb-12 { margin-bottom: 12px !important; }
.mb-15 { margin-bottom: 15px !important; }
.mb-20 { margin-bottom: 20px !important; }
.mb-24 { margin-bottom: 24px !important; }
.mb-30 { margin-bottom: 30px !important; }
.mb-48 { margin-bottom: 48px !important; }
.mt-0 { margin-top: 0 !important; }
.mt-8 { margin-top: 8px !important; }
.mt-15 { margin-top: 15px !important; }
.mr-8 { margin-right: 8px !important; }
.mr-10 { margin-right: 10px !important; }

.p-0 { padding: 0 !important; }
.p-15 { padding: 15px !important; }
.p-20 { padding: 20px !important; }
.p-24 { padding: 24px !important; }

.text-white { color: white !important; }
.text-muted { color: var(--text-muted) !important; }
.text-dim { color: var(--text-dim) !important; }
.text-success { color: var(--color-success) !important; }
.text-danger { color: var(--color-danger) !important; }
.font-outfit { font-family: var(--font-heading) !important; }
.font-mono { font-family: var(--font-mono) !important; }
.font-bold { font-weight: 700 !important; }
.font-semibold { font-weight: 600 !important; }
.font-black { font-weight: 900 !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-left { text-align: left !important; }

.w-full { width: 100% !important; }
.h-full { height: 100% !important; }

.border-none { border: none !important; }
.rounded-12 { border-radius: 12px !important; }
.rounded-16 { border-radius: 16px !important; }

.alert-card-success {
    background: rgba(16, 185, 129, 0.1) !important;
    border-left: 4px solid var(--color-success) !important;
    padding: 15px !important;
    margin-bottom: 20px !important;
    border-radius: var(--border-radius-sm) !important;
    font-size: 0.85rem;
}
.alert-card-error {
    background: rgba(239, 68, 68, 0.1) !important;
    border-left: 4px solid var(--color-danger) !important;
    padding: 15px !important;
    margin-bottom: 20px !important;
    border-radius: var(--border-radius-sm) !important;
    font-size: 0.85rem;
}
.alert-card-info {
    background: rgba(99, 102, 241, 0.15) !important;
    border-left: 4px solid var(--color-primary) !important;
    padding: 15px !important;
    margin-bottom: 20px !important;
    border-radius: var(--border-radius-sm) !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    color: #fff !important;
    font-size: 0.85rem;
}

.sub-tabs-container {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: var(--neo-border);
    padding-bottom: 12px;
    flex-wrap: wrap;
}

.sub-tab-btn {
    background: rgba(255, 255, 255, 0.03);
    border: var(--neo-border);
    border-radius: var(--border-radius-sm);
    padding: 8px 16px;
    color: var(--text-muted);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-standard);
    font-family: var(--font-heading);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sub-tab-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: white;
}

.sub-tab-btn.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--color-primary);
    color: var(--text-pure);
}

.sub-tab-content {
    display: none;
}

.sub-tab-content.active {
    display: block;
    animation: auroraFadeIn 0.4s ease-out;
}

/* Autocomplete Dark Mode Fixes */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
    -webkit-text-fill-color: #ffffff !important;
    -webkit-box-shadow: 0 0 0px 1000px #0f172a inset !important;
    transition: background-color 5000s ease-in-out 0s;
}
