/* ==========================================================================
   TaleStamp - Decentralized Priority Proof System
   Main Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   Variables & Theme
   -------------------------------------------------------------------------- */

:root {
    --bs-primary: #667eea;
    --bs-primary-dark: #5568d3;
    --bs-secondary: #764ba2;
    --bs-success: #10b981;
    --bs-danger: #ef4444;
    --bs-warning: #f59e0b;
    --bs-info: #3b82f6;
    --bs-light: #f8f9fa;
    --bs-dark: #1a1a2e;
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Courier New', monospace;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 15px 40px rgba(0, 0, 0, 0.2);
    
    --radius-sm: 0.25rem;
    --radius: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 1rem;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --------------------------------------------------------------------------
   Base Styles
   -------------------------------------------------------------------------- */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    line-height: 1.6;
    color: #333;
    background-color: #fff;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: #2d3748;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.125rem; }

p {
    margin-bottom: 1rem;
}

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

a:hover {
    color: var(--bs-primary-dark);
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.main-content {
    padding-top: 100px;
    min-height: calc(100vh - 200px);
}

.container {
    max-width: 1200px;
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */

.navbar {
    padding: 0.75rem 0;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: var(--bs-primary) !important;
}

.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: #f8f9fa;
    color: var(--bs-primary);
}

.dropdown-divider {
    margin: 0.5rem 0;
    border-color: #e0e0e0;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
    font-weight: 600;
    border-radius: var(--radius);
    padding: 0.75rem 1.5rem;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-secondary) 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

.btn-outline-primary {
    color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.btn-outline-primary:hover {
    background: var(--bs-primary);
    color: white;
    border-color: var(--bs-primary);
}

.btn-outline-light {
    color: white;
    border-color: white;
}

.btn-outline-light:hover {
    background: white;
    color: #333;
    border-color: white;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.form-control,
.form-select {
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(102, 126, 234, 0.25);
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--bs-danger);
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    box-shadow: 0 0 0 0.25rem rgba(239, 68, 68, 0.25);
}

.input-group-text {
    background: #f8f9fa;
    border-radius: var(--radius);
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

.card {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    border-bottom: 1px solid #e0e0e0;
    padding: 1.25rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */

.alert {
    border: none;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow);
}

.alert-dismissible .btn-close {
    padding: 0.75rem 1rem;
}

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */

.badge {
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius);
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table {
    border-radius: var(--radius);
    overflow: hidden;
}

.table th,
.table td {
    padding: 1rem;
    vertical-align: middle;
}

.table-striped tbody tr:nth-of-type(odd) {
    background: #f8f9fa;
}

.table-bordered {
    border: 1px solid #e0e0e0;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid #e0e0e0;
}

/* --------------------------------------------------------------------------
   Lists
   -------------------------------------------------------------------------- */

.list-group {
    border-radius: var(--radius);
}

.list-group-item {
    border-left: none;
    border-right: none;
    padding: 0.75rem 1rem;
}

.list-group-item:first-child {
    border-top: none;
}

.list-group-item:last-child {
    border-bottom: none;
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

.text-primary {
    color: var(--bs-primary) !important;
}

.text-secondary {
    color: var(--bs-secondary) !important;
}

.bg-primary {
    background-color: var(--bs-primary) !important;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-secondary) 100%);
}

/* Spacing utilities */
.pt-4 { padding-top: 1.5rem !important; }
.pb-4 { padding-bottom: 1.5rem !important; }

/* --------------------------------------------------------------------------
   Custom Components
   -------------------------------------------------------------------------- */

/* Hash display */
.hash-display {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    word-break: break-all;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-confirmed {
    background: #d1fae5;
    color: #065f46;
}

.status-verified {
    background: #a7f3d0;
    color: #047857;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    .main-content {
        padding-top: 90px;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    
    .hero-section {
        padding: 80px 0 60px;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */

@media print {
    .navbar,
    .footer,
    .btn,
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .card {
        border: 1px solid #ddd;
        break-inside: avoid;
    }
}

/* --------------------------------------------------------------------------
   Scrollbar Styling
   -------------------------------------------------------------------------- */

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--bs-primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bs-primary-dark);
}

/* --------------------------------------------------------------------------
   Selection Styling
   -------------------------------------------------------------------------- */

::selection {
    background: var(--bs-primary);
    color: white;
}

/* ==========================================================================
   Proton-Style Design System (AIDesigner Integration)
   ========================================================================== */

/* Custom Webkit Scrollbar */
.proton-theme ::-webkit-scrollbar {
    width: 8px;
}
.proton-theme ::-webkit-scrollbar-track {
    background: #09090b;
}
.proton-theme ::-webkit-scrollbar-thumb {
    background: #27272a;
    border-radius: 4px;
}
.proton-theme ::-webkit-scrollbar-thumb:hover {
    background: #3f3f46;
}

/* Liquid Refraction Utility */
.glass-panel {
    background: rgba(24, 24, 27, 0.6) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.05) !important;
}

/* Dynamic Spotlight Effect */
.spotlight-wrapper {
    position: relative;
}

.spotlight-element {
    position: relative;
    overflow: hidden;
}

.spotlight-element::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(
        800px circle at var(--mouse-x, 0) var(--mouse-y, 0), 
        rgba(109, 74, 255, 0.15), 
        transparent 40%
    );
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.spotlight-wrapper:hover .spotlight-element::before {
    opacity: 1;
}

/* Animated Dashed Border for Dropzone */
.dashed-border-animate {
    background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='40' ry='40' stroke='%233F3F46' stroke-width='2' stroke-dasharray='12%2c 12' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e") !important;
    transition: background-image 0.3s ease;
}

.drag-active .dashed-border-animate,
.dashed-border-animate:hover {
    background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='40' ry='40' stroke='%236D4AFF' stroke-width='2' stroke-dasharray='12%2c 12' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e") !important;
}

/* Grid Background Pattern */
.bg-grid-pattern {
    background-size: 40px 40px;
    background-image: linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
                      linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
}

/* Typography Glitch/Highlight */
.text-gradient {
    background: linear-gradient(135deg, #ffffff 0%, #a1a1aa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-brand-gradient {
    background: linear-gradient(135deg, #a78bfa 0%, #6d4aff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Utilities */
.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ==========================================================================
   Global Bootstrap 5 Overrides for Proton Dark Theme
   ========================================================================== */

.proton-theme {
    background-color: #09090b !important;
    color: #d4d4d8 !important;
}

/* Cards & Containers */
.proton-theme .card {
    background: rgba(24, 24, 27, 0.6) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 20px !important;
    color: #e4e4e7 !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4) !important;
}

.proton-theme .card-header {
    background: rgba(9, 9, 11, 0.5) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    font-weight: 600;
}

.proton-theme .card-footer {
    background: rgba(9, 9, 11, 0.5) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.proton-theme .card-title, 
.proton-theme h1, 
.proton-theme h2, 
.proton-theme h3, 
.proton-theme h4, 
.proton-theme h5, 
.proton-theme h6 {
    color: #ffffff !important;
}

/* Lists */
.proton-theme .list-group {
    background: transparent !important;
}

.proton-theme .list-group-item {
    background-color: transparent !important;
    color: #d4d4d8 !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
}

/* Forms */
.proton-theme label,
.proton-theme .form-label {
    color: #a1a1aa !important; /* zinc-400 */
    font-weight: 500;
}

.proton-theme .form-control,
.proton-theme .form-select {
    background-color: #18181b !important; /* zinc-900 */
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    border-radius: 10px !important;
    padding: 0.6rem 1rem !important;
}

.proton-theme .form-control:focus,
.proton-theme .form-select:focus {
    background-color: #18181b !important;
    border-color: #6d4aff !important; /* brand-700 */
    box-shadow: 0 0 0 2px rgba(109, 74, 255, 0.2) !important;
    color: #ffffff !important;
}

.proton-theme .form-control[readonly],
.proton-theme .form-control[disabled] {
    background-color: #09090b !important; /* zinc-950 */
    opacity: 0.6;
    color: #a1a1aa !important;
}

.proton-theme .form-text {
    color: #71717a !important; /* zinc-500 */
}

.proton-theme .input-group-text {
    background-color: #27272a !important; /* zinc-800 */
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #d4d4d8 !important;
}

/* Tables */
.proton-theme .table {
    color: #d4d4d8 !important;
    --bs-table-bg: transparent !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
}

.proton-theme thead th {
    color: #ffffff !important;
    border-bottom-width: 1px !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    font-weight: 600;
}

.proton-theme .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02) !important;
    color: #ffffff !important;
}

.proton-theme td, 
.proton-theme th {
    border-color: rgba(255, 255, 255, 0.05) !important;
}

/* Alerts */
.proton-theme .alert {
    background-color: rgba(24, 24, 27, 0.8) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 12px !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.proton-theme .alert-info {
    color: #38bdf8 !important; /* sky-400 */
    border-color: rgba(56, 189, 248, 0.2) !important;
    background-color: rgba(56, 189, 248, 0.05) !important;
}

.proton-theme .alert-success {
    color: #34d399 !important; /* emerald-400 */
    border-color: rgba(52, 211, 153, 0.2) !important;
    background-color: rgba(52, 211, 153, 0.05) !important;
}

.proton-theme .alert-danger,
.proton-theme .alert-error {
    color: #f87171 !important; /* red-400 */
    border-color: rgba(248, 113, 113, 0.2) !important;
    background-color: rgba(248, 113, 113, 0.05) !important;
}

.proton-theme .alert-warning {
    color: #fbbf24 !important; /* amber-400 */
    border-color: rgba(251, 191, 36, 0.2) !important;
    background-color: rgba(251, 191, 36, 0.05) !important;
}

/* Modals */
.proton-theme .modal-content {
    background-color: #18181b !important; /* zinc-900 */
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 20px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5) !important;
    color: #d4d4d8 !important;
}

.proton-theme .modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.proton-theme .modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* Badges */
.proton-theme .badge.bg-success {
    background-color: rgba(52, 211, 153, 0.1) !important;
    color: #34d399 !important;
    border: 1px solid rgba(52, 211, 153, 0.2) !important;
}

.proton-theme .badge.bg-primary {
    background-color: rgba(109, 74, 255, 0.1) !important;
    color: #a78bfa !important;
    border: 1px solid rgba(109, 74, 255, 0.2) !important;
}

.proton-theme .badge.bg-warning {
    background-color: rgba(251, 191, 36, 0.1) !important;
    color: #fbbf24 !important;
    border: 1px solid rgba(251, 191, 36, 0.2) !important;
}

.proton-theme .badge.bg-danger {
    background-color: rgba(248, 113, 113, 0.1) !important;
    color: #f87171 !important;
    border: 1px solid rgba(248, 113, 113, 0.2) !important;
}

/* Buttons */
.proton-theme .btn-primary {
    background: #6d4aff !important;
    border-color: #6d4aff !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(109, 74, 255, 0.3) !important;
    border-radius: 30px !important;
}

.proton-theme .btn-primary:hover {
    background: #5b21b6 !important;
    border-color: #5b21b6 !important;
    box-shadow: 0 0 15px rgba(109, 74, 255, 0.5) !important;
}

.proton-theme .btn-outline-primary {
    color: #a78bfa !important;
    border-color: #6d4aff !important;
    border-radius: 30px !important;
}

.proton-theme .btn-outline-primary:hover {
    background: #6d4aff !important;
    color: #ffffff !important;
}

.proton-theme .btn-secondary,
.proton-theme .btn-outline-secondary {
    border-radius: 30px !important;
}

/* Pagination */
.proton-theme .page-link {
    background-color: #18181b !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: #d4d4d8 !important;
}

.proton-theme .page-link:hover {
    background-color: #27272a !important;
    color: #ffffff !important;
}

.proton-theme .page-item.active .page-link {
    background-color: #6d4aff !important;
    border-color: #6d4aff !important;
    color: #ffffff !important;
}

/* Technical Code/Pre sections */
.proton-theme pre,
.proton-theme code {
    background-color: #18181b !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #f4f4f5 !important;
    border-radius: 8px !important;
}

/* General Link Text color */
.proton-theme a:not(.btn):not(.navbar-brand):not(.nav-link) {
    color: #a78bfa !important;
}

.proton-theme a:not(.btn):not(.navbar-brand):not(.nav-link):hover {
    color: #c4b5fd !important;
    text-decoration: underline !important;
}

/* Text Overrides */
.proton-theme .text-muted {
    color: #71717a !important;
}

.proton-theme .text-dark {
    color: #ffffff !important;
}

/* Placeholder styling for carbon fields */
.proton-theme ::placeholder {
    color: #a1a1aa !important;
    opacity: 0.85 !important;
}

.proton-theme :-ms-input-placeholder {
    color: #a1a1aa !important;
    opacity: 0.85 !important;
}

.proton-theme ::-ms-input-placeholder {
    color: #a1a1aa !important;
    opacity: 0.85 !important;
}

/* Page Header Overrides to match Proton-style Dark Theme */
.proton-theme section[style*="linear-gradient(135deg, #1a1a2e"] {
    background: linear-gradient(180deg, rgba(109, 74, 255, 0.12) 0%, rgba(9, 9, 11, 0) 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding-top: 4rem !important;
    padding-bottom: 4rem !important;
    position: relative;
    overflow: hidden;
}

/* Background grid pattern matching homepage for all page headers */
.proton-theme section[style*="linear-gradient(135deg, #1a1a2e"]::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0.3;
    pointer-events: none;
    background-size: 40px 40px;
    background-image: linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
                      linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
}

.proton-theme section[style*="linear-gradient(135deg, #1a1a2e"] > .container {
    position: relative;
    z-index: 10;
}
