/* ===== GLOBAL STYLES ===== */
:root {
  --primary-dark: #0b245b;
  --primary-dark-alt: #0f172a;
  --primary-blue: #2563eb;
  --accent-gold: #ffd700;
  --accent-gold-hover: #e2c100;
  --light-bg: #f4f6f9;
  --light-card: #ffffff;
  --light-text: #333333;
  --dark-bg: #0f172a;
  --dark-card: #020617;
  --dark-text: #e5e7eb;
  --success: green;
  --danger: #dc2626;
  --warning: #facc15;
  --muted: #64748b;
  --border: #e5e7eb;
  --shadow: 0 2px 6px rgba(0,0,0,0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  background: #ffffff;
  color: #333333;
  position: relative;
  overflow-x: hidden;
}

/* ===== LAYOUT & CONTAINERS ===== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.content {
  margin-left: 270px;
  padding: 20px;
}

.content.no-sidebar {
  margin-left: 0;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
  margin-bottom: 1rem;
  color: inherit;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
  color: var(--primary-dark);
}

.section-title {
  font-size: 1.25rem;
  font-weight: bold;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
}

/* ===== HEADER ===== */
header {
  background: var(--primary-dark);
  padding: 20px;
  color: white;
  border-radius: 10px;
  margin-bottom: 20px;
  text-align: center;
}

/* ===== NAVIGATION ===== */
.top-nav {
  text-align: center;
  margin-bottom: 30px;
  padding: 15px;
  background: var(--dark-card);
}

.top-nav a {
  margin: 0 12px;
  color: #38bdf8;
  text-decoration: none;
  font-weight: 500;
}

.top-nav a:hover {
  text-decoration: underline;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 250px;
  height: 100%;
  background: var(--primary-dark);
  color: white;
  padding: 20px;
  z-index: 100;
}

.sidebar h2 {
  margin-top: 0;
  color: white;
}

.sidebar a {
  display: block;
  padding: 10px 0;
  color: white;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.2);
}

.sidebar a:hover {
  color: var(--accent-gold);
}

/* ===== CARDS & BOXES ===== */
.box, .card, .blog-card, .result-box, .community-box {
  background: var(--light-card);
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.dark-theme .box, 
.dark-theme .card, 
.dark-theme .blog-card,
.dark-theme .community-box {
  background: var(--dark-card);
  border: 1px solid #1e293b;
  color: var(--dark-text);
}

.result-box {
  background: #eef4ff;
  padding: 20px;
  border-radius: 10px;
  display: none;
}

/* ===== TABLES ===== */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

th, td {
  padding: 12px;
  border: 1px solid #ddd;
  text-align: left;
}

th {
  background: var(--primary-dark);
  color: white;
}

tr:hover {
  background: #eef2f9;
}

.dark-theme table {
  background: var(--dark-card);
}

.dark-theme th, 
.dark-theme td {
  border: 1px solid #1e293b;
}

.dark-theme tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* ===== FORMS & INPUTS ===== */
input, textarea, select {
  width: 100%;
  padding: 12px 15px;
  margin-top: 8px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 16px;
  font-family: Arial, sans-serif;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.form-group {
  margin-top: 20px;
}

.dark-theme input,
.dark-theme textarea,
.dark-theme select {
  background: #1e293b;
  border: 1px solid #334155;
  color: var(--dark-text);
}

/* ===== BUTTONS ===== */
button, .btn {
  padding: 12px 20px;
  border-radius: 8px;
  border: none;
  font-size: 16px;
  cursor: pointer;
  font-weight: bold;
  text-decoration: none;
  display: inline-block;
  transition: background-color 0.2s;
}

.btn-primary {
  background: var(--primary-blue);
  color: white;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-gold {
  background: var(--accent-gold);
  color: var(--primary-dark);
}

.btn-gold:hover {
  background: var(--accent-gold-hover);
}

button:not([class]), 
.btn:not([class]) {
  background: var(--accent-gold);
  color: var(--primary-dark);
  margin-top: 15px;
}

button:not([class]):hover, 
.btn:not([class]):hover {
  background: var(--accent-gold-hover);
}

/* ===== STATUS INDICATORS ===== */
.good {
  color: var(--success);
  font-weight: bold;
}

.bad {
  color: var(--danger);
  font-weight: bold;
}

.warning {
  color: var(--warning);
  font-weight: bold;
}

.reported {
  background: #fef2f2;
  border-left: 4px solid var(--danger);
  padding-left: 15px;
}

/* ===== LISTS ===== */
ul {
  padding-left: 20px;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 8px;
}

/* ===== LOADER ===== */
.loader {
  margin-top: 15px;
  display: none;
  text-align: center;
  font-weight: bold;
  color: var(--primary-dark);
}

/* ===== FOOTER ===== */
footer {
  margin-top: 35px;
  padding: 20px;
  text-align: center;
  background: var(--primary-dark);
  color: white;
  border-radius: 10px;
}

.dark-theme footer {
  background: #020617;
}

/* ===== UTILITIES ===== */
.text-center {
  text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.hidden {
  display: none;
}

/* ===== THEME VARIATIONS ===== */
.light-theme {
  background: var(--light-bg);
  color: var(--light-text);
}

.dark-theme {
  background: var(--dark-bg);
  color: var(--dark-text);
}

.dark-theme h2 {
  color: #38bdf8;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
  }
  
  .content {
    margin-left: 0;
    padding: 15px;
  }
  
  .content.no-sidebar {
    padding: 15px;
  }
  
  .top-nav a {
    display: block;
    margin: 8px 0;
  }
  
  table {
    font-size: 14px;
  }
  
  th, td {
    padding: 8px;
  }
}

.alert {
    padding: 15px;
    margin: 15px 0;
    border-radius: 5px;
}
.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.admin-panel {
    background: #f8f9fa;
    padding: 20px;
    margin: 20px 0;
    border: 2px solid #007bff;
}
.pending-story {
    background: #fff3cd;
    padding: 10px;
    margin: 10px 0;
    border-left: 4px solid #ffc107;
}

/* ===== INDEX.PHP SPECIFIC STYLES (moved from embedded <style>) ===== */

/* Main Layout - Fixed the overlapping issue */
.main-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Community Sidebar Styles - Updated for non-overlapping layout */
.community-sidebar {
    width: 320px;
    min-width: 320px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: white;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 4px 0 12px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #334155;
}

.sidebar-header h3 {
    color: #fbbf24;
    margin: 0 0 5px 0;
    font-size: 18px;
}

.sidebar-subtitle {
    color: #94a3b8;
    font-size: 13px;
    margin: 0;
}

/* Story Preview Items */
.stories-preview {
    margin-bottom: 30px;
}

.story-preview-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.story-preview-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #f59e0b;
    transform: translateX(3px);
}

.story-category {
    display: inline-block;
    background: #f59e0b;
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.story-author {
    color: #cbd5e1;
    font-size: 13px;
    margin-bottom: 10px;
}

.author-icon {
    margin-right: 5px;
}

.story-preview-content {
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
}

.story-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 10px;
}

.comments-badge {
    background: rgba(59, 130, 246, 0.2);
    padding: 3px 8px;
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.read-more-link {
    color: #60a5fa;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    display: inline-block;
}

.read-more-link:hover {
    color: #93c5fd;
    text-decoration: underline;
}

/* Sidebar CTA */
.sidebar-cta {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    text-align: center;
}

.sidebar-cta p {
    color: #fbbf24;
    margin: 0 0 10px 0;
    font-size: 14px;
}

.cta-button {
    display: block;
    background: #f59e0b;
    color: white;
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 6px;
    font-weight: 600;
    margin-bottom: 10px;
    transition: background 0.3s;
}

.cta-button:hover {
    background: #d97706;
}

.small-note {
    color: #94a3b8;
    font-size: 11px !important;
    margin-top: 10px !important;
}

.signup-link {
    color: #10b981;
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
}

.signup-link:hover {
    text-decoration: underline;
}

/* Comments Preview */
.comments-preview {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #334155;
}

.comments-preview h4 {
    color: #fbbf24;
    font-size: 16px;
    margin-bottom: 15px;
}

.comment-preview-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
}

.comment-header {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 8px;
}

.comment-author {
    color: #cbd5e1;
    font-weight: 500;
}

.comment-preview-text {
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.4;
    font-style: italic;
    margin-bottom: 8px;
}

.view-comment-link {
    color: #60a5fa;
    font-size: 11px;
    text-decoration: none;
}

.view-comment-link:hover {
    text-decoration: underline;
}

/* No Stories/Error States */
.no-stories, .error-preview {
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed #475569;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
}

/* Main Content Area - Updated to work with sidebar */
.main-content {
    flex: 1;
    padding: 20px 40px;
    max-width: 100%;
    overflow-x: hidden;
}

.locked {
    opacity: 0.8;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
    border-left: 4px solid #ff6b6b;
}

.preview-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.preview-card p {
    margin: 10px 0;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 4px;
    border-left: 3px solid #4f46e5;
}

.cta {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 12px;
    margin: 20px 0;
    text-align: center;
    font-weight: 500;
}

.form-group {
    margin: 20px 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 16px;
    margin-bottom: 10px;
}

.form-group input:focus {
    outline: none;
    border-color: #4f46e5;
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: block;
    width: 100%;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

ul {
    margin: 15px 0;
    padding-left: 20px;
}

ul li {
    margin: 8px 0;
    padding-left: 10px;
}

.box h2 {
    color: #1e293b;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
    font-size: 1.2rem;
}

.subtitle {
    color: #64748b;
    font-size: 18px;
    text-align: center;
    margin-bottom: 20px;
    font-style: italic;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 10px;
}

.container h1 {
    text-align: center;
    color: #1e293b;
    margin-bottom: 10px;
}

.box {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: #64748b;
    font-size: 14px;
    border-top: 1px solid #e2e8f0;
}

/* Index page layout: breach check + community sidebar */
.main-wrapper {
    display: flex;
    gap: 30px;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 30px;
    align-items: stretch;
    box-sizing: border-box;
}

.main-content {
    flex: 1;
    min-width: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
}

.community-sidebar {
    width: 320px;
    flex-shrink: 0;
    position: relative;
    height: 100%;
    overflow-y: auto;
}

/* Side-by-side steps layout - PARALLEL */
.steps-container {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 30px;
    margin-bottom: 30px;
    align-items: stretch;
    width: 100% !important;
}

.step-box {
    flex: 1 !important;
    margin-bottom: 0 !important;
    min-width: 0 !important;
    width: 33.33% !important;
    box-sizing: border-box !important;
    min-height: 600px;
}

/* Ensure equal height boxes */
.step-box {
    display: flex;
    flex-direction: column;
}

.step-box > * {
    flex: 1;
}

.step-box form {
    flex: 0;
}

/* Mobile Responsiveness for Index Page */
@media (max-width: 1024px) {
    .main-wrapper {
        flex-direction: column;
        width: 100%;
        height: auto;
    }
    
    .community-sidebar {
        position: relative;
        width: 100%;
        height: auto;
        max-height: 500px;
        min-width: auto;
        margin-bottom: 20px;
        border-radius: 10px;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .steps-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .step-box {
        min-height: auto;
    }
}

@media (max-width: 768px) {
    .community-sidebar {
        max-height: 400px;
        overflow-y: auto;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .container {
        padding: 10px;
    }
    
    .box {
        padding: 20px;
        margin: 20px 0;
    }
}

/* Force proper stacking on very small screens */
@media (max-width: 480px) {
    .main-wrapper {
        padding: 10px;
        gap: 15px;
    }
    
    .step-box {
        padding: 15px !important;
    }
    
    .step-box h2 {
        font-size: 1.1rem;
    }
    
    /* Make breach results more compact */
    .step-box .form-group {
        max-height: 300px;
    }
}