/*
 * KaliPatriot.net - Consolidated Custom Styles
 * This file consolidates styles from main.css, home.css, blog.css, admin.css, and other page-specific CSS
 * to eliminate redundancy and ensure consistent design across the site.
 */

/* ===== CSS CUSTOM PROPERTIES (VARIABLES) ===== */
:root {
    /* Primary Color Palette */
    --primary-color: #2196f3;
    --primary-dark: #1976d2;
    --primary-light: #64b5f6;
    --secondary-color: #37474f;
    --success-color: #4caf50;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --info-color: #03a9f4;

    /* Background Colors */
    --background-dark: #0a0a0a;
    --background-light: #1a1a1a;
    --background-card: #242424;
    --dark-light: #161b22;
    --dark-bg: #0d1117;

    /* Text Colors */
    --text-primary: #f5f5f5;
    --text-secondary: #b0b0b0;
    --text-muted: #888888;

    /* Border and Layout */
    --border-color: #3a3a3a;
    --border-dark: #21262d;
    --border-radius: 0.375rem;

    /* Effects */
    --box-shadow: 0 0.125rem 0.25rem rgba(33, 150, 243, 0.075);
    --box-shadow-hover: 0 0.5rem 1rem rgba(33, 150, 243, 0.15);
    --transition: all 0.15s ease-in-out;

    /* Admin-specific colors */
    --admin-primary: #2196f3;
    --admin-success: #4caf50;
    --admin-danger: #f44336;
    --admin-warning: #ff9800;
    --admin-info: #03a9f4;
    --admin-light: #1a1a1a;
    --admin-dark: #000000;
    --admin-border-radius: 0.375rem;
    --admin-box-shadow: 0 0.125rem 0.25rem rgba(0, 188, 212, 0.075);
    --admin-transition: all 0.15s ease-in-out;
}

/* ===== RESPONSIVE NAVIGATION FIX ===== */
/* Fix for Tailwind CSS responsive navigation classes being overridden by hidden class */
@media (min-width: 768px) {
    .hidden.md\:flex {
        display: flex !important;
    }

    .md\:hidden {
        display: none !important;
    }
}

@media (max-width: 767px) {
    .md\:hidden {
        display: block !important;
    }

    .hidden.md\:flex {
        display: none !important;
    }
}

/* ===== GLOBAL STYLES ===== */
html {
    overflow-x: hidden;
}

body {
    background-color: var(--background-dark);
    color: var(--text-primary);
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* ===== NAVIGATION STYLES ===== */
.navbar {
    background-color: var(--background-light) !important;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.navbar-brand {
    color: var(--primary-color) !important;
    font-weight: 700;
}

.navbar-brand:hover {
    color: var(--primary-dark) !important;
}

.nav-dropdown {
    z-index: 1050 !important;
    position: absolute !important;
}

.brand-icon {
    font-size: 1.2em;
    margin-right: 0.5rem;
}

.nav-link {
    font-weight: 500;
    transition: var(--transition);
    color: var(--text-primary) !important;
}

.nav-link:hover {
    color: var(--primary-light) !important;
}

/* ===== BUTTON STYLES ===== */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: var(--border-radius);
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    font-weight: 500;
}

.btn:hover {
    text-decoration: none;
}

.btn:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(33, 150, 243, 0.25);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

.btn-outline-primary {
    border: 2px solid var(--primary-color) !important;
    color: var(--primary-color) !important;
    background-color: transparent !important;
    font-weight: 600;
    transition: var(--transition);
}

.btn-outline-primary:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
    text-decoration: none;
}

/* Fix for Discord login button spacing in login prompt */
.login-prompt .btn {
    margin-top: 1rem;
}

/* Ensure buttons in blog context maintain proper styling */
.post-summary .btn-outline-primary {
    border-width: 2px;
    border-style: solid;
}

.btn-outline-secondary {
    border: 2px solid var(--text-muted, #6c757d);
    color: var(--text-primary, #333);
    background-color: transparent;
    font-weight: 600;
    transition: var(--transition);
}

.btn-outline-secondary:hover {
    background: var(--text-muted, #6c757d);
    border-color: var(--text-muted, #6c757d);
    color: white;
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    color: white;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #388e3c);
    border: none;
    color: white;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #66bb6a, var(--success-color));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    color: white;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(45deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    /* Fallback for browsers that don't support background-clip */
    color: var(--primary-color);
}

h2 {
    font-size: 2rem;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* ===== CARD STYLES ===== */
.card {
    background-color: var(--background-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    color: var(--text-primary);
}

.card:hover {
    box-shadow: var(--box-shadow-hover);
    transform: translateY(-0.125rem);
    border-color: var(--primary-color);
}

.card-header {
    background-color: rgba(33, 150, 243, 0.1);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.card-body {
    color: var(--text-primary);
}

.card-footer {
    background-color: rgba(33, 150, 243, 0.05);
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

/* ===== TABLE STYLES ===== */
.table {
    background-color: var(--background-card);
    color: var(--text-primary);
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.table thead th {
    background-color: var(--primary-color);
    color: var(--background-dark);
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

.table tbody tr {
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background-color: rgba(33, 150, 243, 0.1);
}

.table tbody td {
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* ===== FORM STYLES ===== */
.form-control {
    background-color: var(--background-light) !important;
    border: 2px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: var(--border-radius);
    padding: 0.5rem 0.75rem;
    transition: var(--transition);
}

.form-control:focus {
    background-color: var(--background-light) !important;
    border-color: var(--primary-color) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(33, 150, 243, 0.25) !important;
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted) !important;
}

.form-control:disabled {
    background-color: var(--background-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-muted) !important;
    opacity: 0.7;
}

.form-label {
    color: var(--text-primary);
    font-weight: 500;
}

/* File input styling */
input[type="file"].form-control {
    background-color: var(--background-light) !important;
    border: 2px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    padding: 0.375rem 0.75rem;
}

/* Select elements */
.form-select, select.form-control {
    background-color: var(--background-light) !important;
    border: 2px solid var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Textarea elements */
textarea.form-control {
    background-color: var(--background-light) !important;
    border: 2px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    resize: vertical;
    min-height: 100px;
}

/* ===== CODE AND CONTENT STYLES ===== */
pre {
    background: var(--background-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius) !important;
    padding: 1rem !important;
    font-size: 0.875rem;
    line-height: 1.5;
    overflow-x: auto;
    position: relative;
    color: var(--text-primary);
}

pre::before {
    content: 'Code';
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

code {
    background: var(--background-card) !important;
    color: var(--primary-color) !important;
    padding: 0.2em 0.4em !important;
    border-radius: 0.25rem !important;
    font-family: 'SFMono-Regular', 'Menlo', 'Monaco', 'Consolas', 'Liberation Mono', 'Courier New', monospace !important;
    font-size: 0.875em;
    border: 1px solid var(--border-color);
}

pre code {
    background: transparent !important;
    color: var(--text-primary) !important;
    padding: 0 !important;
    border: none !important;
}

blockquote {
    border-left: 4px solid var(--primary-color);
    background: rgba(33, 150, 243, 0.1);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    font-style: italic;
    color: var(--text-primary);
    border-right: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

blockquote p:last-child {
    margin-bottom: 0;
    color: var(--text-primary);
}

/* ===== BADGE AND TAG STYLES ===== */
.badge {
    font-weight: 500;
    letter-spacing: 0.05em;
}

.badge-primary {
    background-color: var(--primary-color);
    color: var(--background-dark);
}

.tag {
    display: inline-block;
    background: var(--background-card);
    color: var(--text-primary);
    padding: 0.25em 0.75em;
    border-radius: 1rem;
    font-size: 0.8em;
    text-decoration: none;
    margin: 0.125rem;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.tag:hover {
    background: var(--primary-color);
    color: var(--background-dark);
    text-decoration: none;
    transform: translateY(-1px);
    border-color: var(--primary-color);
}

/* ===== HERO SECTION (HOME PAGE) ===== */
.hero-section {
    background: linear-gradient(135deg, #0d1117 0%, #161b22 25%, #21262d 50%, #30363d 75%, #21262d 100%);
    color: white;
    padding: 40px 20px 30px 20px;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, #2196f3, #1976d2, #0d47a1) 1;
    box-shadow: 0 4px 20px rgba(33, 150, 243, 0.1);
}

.hero-section .container {
    position: relative;
    z-index: 1;
}

.hero-section .row {
    position: relative;
    z-index: 1;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(33, 150, 243, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(25, 118, 210, 0.06) 0%, transparent 40%),
        linear-gradient(45deg, transparent 0%, rgba(33, 150, 243, 0.02) 50%, transparent 100%);
    animation: pulse 8s ease-in-out infinite;
}

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

/* ===== BLOG POST STYLES ===== */
.blog-post {
    background: linear-gradient(135deg, #161b22 0%, #1a1f26 50%, #1e2328 100%);
    border: 1px solid rgba(33, 150, 243, 0.1);
    border-radius: 12px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(33, 150, 243, 0.05);
    position: relative;
    overflow: hidden;
}

.blog-post::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 20%, rgba(33, 150, 243, 0.03) 0%, transparent 50%);
}

.blog-meta {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 1.5rem;
}

.blog-content {
    line-height: 1.8;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.blog-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin: 1rem 0;
    border: 1px solid var(--border-color);
}

/* Blog Post Navigation */
.post-nav {
    background: var(--background-card) !important;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 2rem;
    border: 1px solid var(--border-color);
}

.post-nav .btn {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
    background-color: transparent !important;
    color: var(--text-primary) !important;
    border: 2px solid var(--border-color) !important;
}

.post-nav .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* ===== ADMIN PANEL STYLES ===== */
.admin-section {
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    background-color: var(--background-card);
    padding: 1.25rem;
}

.admin-section h3 {
    margin-top: 0;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--admin-primary);
    padding-bottom: 0.5rem;
    color: var(--text-primary);
}

.settings-section {
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    background-color: var(--background-card);
    padding: 1.25rem;
}

.settings-section h3 {
    margin-top: 0;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--admin-primary);
    padding-bottom: 0.5rem;
    color: var(--text-primary);
}

.admin-content {
    background-color: transparent;
}

.admin-form .form-group {
    margin-bottom: 1rem;
}

.admin-form label {
    margin-bottom: 0.25rem;
    display: block;
    font-weight: 600;
    color: var(--text-primary);
}

.admin-form input,
.admin-form select,
.admin-form textarea {
    width: 100%;
    border-radius: 0.25rem;
    border: 1px solid var(--border-color);
    background-color: var(--background-card);
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
    border-color: var(--admin-primary);
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 1px var(--admin-primary);
}

.admin-form textarea {
    resize: vertical;
}

.admin-form small {
    margin-top: 0.25rem;
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ===== PROFILE STYLES ===== */
.profile-header {
    background: linear-gradient(135deg, var(--background-light), var(--background-card));
    color: var(--text-primary);
    padding: 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--primary-color);
    object-fit: cover;
    box-shadow: 0 0.5rem 1rem rgba(33, 150, 243, 0.3);
}

.profile-avatar-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--background-card);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
    font-weight: bold;
    border: 4px solid var(--primary-color);
}

/* ===== SEARCH AND FILTER COMPONENTS ===== */
.search-form {
    background: var(--background-card);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.search-input {
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
    transition: var(--transition);
    background-color: var(--background-light);
    color: var(--text-primary);
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(33, 150, 243, 0.25);
    background-color: var(--background-light);
    color: var(--text-primary);
}

.search-input::placeholder {
    color: var(--text-muted);
}

/* ===== ALERT STYLES ===== */
.alert {
    position: relative;
    border-radius: 0.25rem;
    border: 1px solid;
    padding: 0.75rem 1rem;
}

.alert-success {
    border-color: rgb(74 222 128);
    background-color: rgb(20 83 45);
    color: rgb(134 239 172);
}

.alert-info {
    border-color: rgb(96 165 250);
    background-color: rgb(30 58 138);
    color: rgb(147 197 253);
}

/* ===== HEALTH CHECK STYLES ===== */
.health-container {
    margin: 2rem auto;
    max-width: 48rem;
    padding: 2rem;
}

.status-error {
    font-weight: 600;
    color: var(--danger-color);
}

.health-item {
    margin-bottom: 0.75rem;
    border-radius: 0.25rem;
    border: 1px solid var(--border-color);
    background-color: var(--background-card);
    padding: 1rem;
}

.health-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

.form-inline {
    display: inline;
}

.comment-edit-form-hidden {
    display: none;
}

.icon-large-muted {
    font-size: 3rem;
    opacity: 0.3;
}

.icon-medium-muted {
    font-size: 2rem;
}

.fs-2rem {
    font-size: 2rem;
}

.fs-3rem {
    font-size: 3rem;
}

.fs-4rem {
    font-size: 4rem;
}

.fs-5rem {
    font-size: 5rem;
}

.fs-8rem {
    font-size: 8rem;
}

.text-admin-info {
    color: var(--admin-info);
}

.preview-image {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
}

.search-form-flex {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.whitespace-nowrap {
    white-space: nowrap;
}

.opacity-03 {
    opacity: 0.3;
}

.opacity-05 {
    opacity: 0.5;
}

.mb-3 {
    margin-bottom: 1rem;
}

/* Table Column Width Utilities */
.col-w-8 { width: 8%; }
.col-w-12 { width: 12%; }
.col-w-15 { width: 15%; }
.col-w-25 { width: 25%; }
.col-w-30 { width: 30%; }
.col-w-35 { width: 35%; }
.col-w-55 { width: 55%; }

.sticky-top-100 {
    position: sticky;
    top: 100px;
}

/* ===== ANIMATIONS ===== */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(2rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading states */
.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    .profile-header {
        text-align: center;
        padding: 1.5rem;
    }

    .profile-avatar {
        width: 100px;
        height: 100px;
    }

    .profile-avatar-placeholder {
        width: 100px;
        height: 100px;
        font-size: 2em;
    }

    .hero-section {
        padding: 30px 15px 20px 15px;
    }
}

@media (max-width: 576px) {
    .search-form {
        padding: 1rem;
    }

    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .btn:last-child {
        margin-bottom: 0;
    }

    .hero-section {
        padding: 20px 10px 15px 10px;
    }

    .blog-post {
        padding: 1.5rem;
    }
}

/* ===== BOOTSTRAP OVERRIDES ===== */
.bg-white {
    background-color: var(--background-card) !important;
}

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

.border {
    border-color: var(--border-color) !important;
}

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

/* ===== LINK STYLES ===== */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

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

/* Username Link Styling */
a[href^="/user/"] {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

a[href^="/user/"]:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.resume-link {
    color: var(--primary-color) !important;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.resume-link:hover {
    color: var(--primary-light) !important;
    text-decoration: underline;
}

.no-resume {
    color: var(--text-muted);
    font-style: italic;
}

/* ===== NOTIFICATION STYLES ===== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.notification-success {
    background-color: var(--success-color);
}

.notification-error {
    background-color: var(--danger-color);
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}
