/* Global CSS for E-Głosowania NGMK - Updated with White Background */

/* Base theme colors */
:root {
    --primary-color: #C1001F;
    --primary-hover: #a0001a;
    --secondary-color: #4b5563;
    --secondary-hover: #374151;
    --success-color: #065f46;
    --danger-color: #C1001F;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --light-color: #f3f4f6;
    --dark-color: #1f2937;
    --border-color: #e5e7eb;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
}

/* Header styling - Darker background with white bottom border and red pipe */
.menu-header {
    border-bottom: 6px solid white !important;
    background-color: #e5e7eb !important; /* Slightly darker grey background */
    padding: 1rem 1.5rem !important; /* Keep proper padding for text */
    margin-bottom: 1rem !important; /* Space after border */
    border-radius: 0.75rem 0.75rem 0 0 !important; /* Match card top corners */
}

.content-header {
    border-bottom: 6px solid white !important;
    background-color: #e5e7eb !important; /* Slightly darker grey background */
    padding: 1rem 1.5rem !important; /* Keep proper padding for text */
    margin-bottom: 1rem !important; /* Space after border */
    border-radius: 0.75rem 0.75rem 0 0 !important; /* Match card top corners */
}

.notifications-header {
    border-bottom: 6px solid white !important;
    background-color: #e5e7eb !important; /* Slightly darker grey background */
    padding: 1rem 1.5rem !important; /* Keep proper padding for text */
    margin-bottom: 1rem !important; /* Space after border */
    border-radius: 0.75rem 0.75rem 0 0 !important; /* Match card top corners */
}

.user-profile-section {
    border-top: 6px solid white !important;
    padding-top: 1rem !important;
    margin-top: auto !important;
    display: flex !important;
    align-items: center !important;
}

/* Add red pipe before headings */
.menu-header h2::before,
.content-header h2::before,
.notifications-header h2::before {
    content: "/ " !important;
    color: var(--primary-color) !important;
    font-weight: bold !important;
    margin-right: 0.5rem !important;
}

/* Maintain h2 styling */
.menu-header h2,
.content-header h2,
.notifications-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

/* General layout - Changed to white background */
body {
    background-color: white;
    min-height: 100vh;
}

/* Fix for grid height compression */
.left-column, .center-column, .right-column {
    min-height: 0;
    overflow-y: auto; /* Allow scrolling instead of compression */
}

.menu-header, .content-header, .notifications-header {
    flex-shrink: 0; /* Prevent header compression */
    min-height: 60px; /* Ensure minimum header height */
}

.container {
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.max-w-4xl {
    max-width: 56rem;
    margin-left: auto;
    margin-right: auto;
}

/* Container styles */
.panel {
    background-color: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.overflow-x-auto {
    overflow-x: auto;
}

.container-spacing {
    padding-top: 0.75rem;
}

/* Container header styles */
.container-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.container-title {
    margin-bottom: 0;
    font-size: 1.125rem;
    font-weight: 500;
}

/* Toggle icon styling */
.toggle-icon {
    float: right;
    cursor: pointer;
    width: 24px;
    height: 24px;
    text-align: center;
    line-height: 24px;
    transition: transform 0.3s ease;
    background-color: var(--light-color);
    border-radius: 50%;
    margin-top: 0;
    font-weight: bold;
    color: var(--secondary-color);
}

.toggle-icon:hover {
    background-color: var(--border-color);
}

/* Primary border */
.border-t {
    border-top-color: var(--primary-color);
    border-top-width: 2px;
}

/* User info container styles */
.voting-data p, .login-data p {
    margin-bottom: 0.5rem;
}

/* Button styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 400;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
    text-decoration: none;
    white-space: nowrap;
    gap: 0.375rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    transition: background 0.3s ease;
}

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

.btn-gray {
    background-color: var(--gray-600);
    color: white;
}

.btn-gray:hover {
    background-color: var(--gray-700);
    color: white;
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
    color: white;
}

/* Small button sizing */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    gap: 0.25rem;
}

/* Button icon styling - simplified with flexbox */
.btn i {
    flex-shrink: 0;
    width: 1em;
    text-align: center;
}

/* Action button styles */
.action-button {
    width: 100px;
    text-align: center;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

/* Vote button styles */
.vote-button {
    flex: 1;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.vote-button-za {
    background-color: var(--success-color);
}

.vote-button-za:hover {
    background-color: #0da271;
}

.vote-button-przeciw {
    background-color: var(--danger-color);
}

.vote-button-przeciw:hover {
    background-color: #dc2626;
}

.vote-button-wstrzymuje {
    background-color: var(--warning-color);
}

.vote-button-wstrzymuje:hover {
    background-color: #facc15;
}

/* Vote status colors */
.vote-status-za {
    color: var(--success-color);
}

.vote-status-przeciw {
    color: var(--danger-color);
}

.vote-status-wstrzymuje {
    color: var(--warning-color);
}

/* Status colors */
.text-green-600 {
    color: #059669;
}

.text-red-600 {
    color: #dc2626;
}

.text-blue-600 {
    color: #2563eb;
}

.text-gray-600 {
    color: var(--gray-600);
}

.text-yellow-600 {
    color: #ca8a04;
}

.text-green-700 {
    color: #047857;
}

.text-green-800 {
    color: #065f46;
}

.text-red-700 {
    color: #b91c1c;
}

.text-red-800 {
    color: #991b1b;
}

.text-yellow-700 {
    color: #a16207;
}

.text-yellow-800 {
    color: #854d0e;
}

/* Table styles */
.table-container {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.max-w-full {
    max-width: 100%;
}

table {
    min-width: 100%;
    background-color: white;
    table-layout: fixed;
}

table thead tr {
    background-color: var(--gray-50);
    color: var(--gray-600);
    text-transform: uppercase;
    font-size: 0.875rem;
    line-height: 1.25;
}

table th {
    padding: 0.75rem 1.5rem;
    text-align: left;
    background-color: var(--gray-50);
}

table th.centered {
    text-align: center;
}

table tbody tr {
    border-bottom: 1px solid var(--gray-200);
}

table tbody tr:hover {
    background-color: var(--gray-50);
}

table td {
    padding: 0.75rem 1.5rem;
    color: var(--gray-600);
    font-size: 0.875rem;
}

table td.centered {
    text-align: center;
}

/* Column widths */
.w-1-2 {
    width: 50%;
}

.w-1-6 {
    width: 16.666667%;
}

.w-8-percent {
    width: 8%;
}

.w-12-percent {
    width: 12%;
}

/* Status badges */
.badge {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 9999px;
    display: inline-block;
    white-space: nowrap;
}

.badge-green {
    background-color: var(--success-color);
    color: white;
}

.badge-yellow {
    background-color: var(--warning-color);
    color: white;
}

.badge-red {
    background-color: var(--danger-color);
    color: white;
}

/* Resolution button styles */
.resolution-button {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 9999px;
    text-align: center;
    white-space: nowrap;
    max-width: 90px;
    width: 100%;
    color: white;
}

.resolution-button-active {
    background-color: var(--primary-color);
}

.resolution-button-active:hover {
    background-color: var(--primary-hover);
}

.resolution-button-inactive {
    background-color: var(--gray-600);
}

.resolution-button-inactive:hover {
    background-color: var(--gray-700);
}

/* Alert styles */
.alert {
    padding: 0.75rem 1rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    margin-bottom: 1.5rem;
    font-size: 1.125rem;
    font-weight: 500;
}

.alert-success {
    background-color: #d1fae5;
    border-color: #a7f3d0;
    color: #047857;
}

.alert-danger {
    background-color: #fee2e2;
    border-color: #fecaca;
    color: #b91c1c;
}

/* Results grid */
.grid {
    display: grid;
}

.grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gap-2 {
    gap: 0.5rem;
}

.bg-green-100 {
    background-color: #d1fae5;
}

.bg-red-100 {
    background-color: #fee2e2;
}

.bg-yellow-100 {
    background-color: #fef3c7;
}

.bg-gray-50 {
    background-color: var(--gray-50);
}

.rounded {
    border-radius: 0.25rem;
}

.text-center {
    text-align: center;
}

.p-2 {
    padding: 0.5rem;
}

.p-3 {
    padding: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-xs {
    font-size: 0.75rem;
}

/* Font styles */
.font-medium {
    font-weight: 500;
}

.font-bold {
    font-weight: 700;
}

/* Italic text */
.italic {
    font-style: italic;
}

/* PDF Preview */
.pdf-container {
    width: 100%;
    height: 800px;
    position: relative;
    border: 1px solid var(--gray-300);
    border-radius: 0.25rem;
    overflow: hidden;
}

iframe {
    width: 100%;
    height: 800px;
    border: none;
}

/* Toggle button for votes */
.vote-toggle {
    cursor: pointer;
    margin-left: 0.5rem;
    background-color: var(--gray-200);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    transition: all 0.2s ease;
}

.vote-toggle:hover {
    background-color: var(--gray-300);
}

/* First, reset the general indicator styling */
.menu-indicator {
    position: absolute;
    right: 1.5rem;
    color: white;
    font-size: 0.75rem;
    border-radius: 9999px;
    padding: 0.1rem 0.4rem;
    min-width: 20px;
    text-align: center;
    /* Remove background-color from here */
}

/* Then specify each type with high specificity */
.menu-item .menu-indicator.indicator-alert {
    background-color: var(--primary-color) !important; /* Dark red for "Zagłosuj" */
}

.menu-item .menu-indicator.indicator-voted {
    background-color: var(--secondary-color) !important; /* Dark grey for "Zagłosowano" */
}

.menu-item .menu-indicator.indicator-active {
    background-color: var(--secondary-color) !important; /* Dark grey for "Aktywne głosowania" */
}

/* Keep this for backward compatibility */
.menu-item .menu-indicator.indicator-info {
    background-color: var(--secondary-color) !important; /* Changed to match the grey color */
}

/* Utility classes */
.hidden {
    display: none;
}

.flex {
    display: flex;
}

.flex-1 {
    flex: 1 1 0%;
}

.space-x-4 > * + * {
    margin-left: 1rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

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

.mb-6 {
    margin-bottom: 1.5rem;
}

.ml-2 {
    margin-left: 0.5rem;
}

.inline-block {
    display: inline-block;
}

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

/* Center Column Scrollbar Fix for E-Vote System */

/* Row 2, Column 2: Center Content Column - Enhanced with proper scrolling */
.center-column {
    background-color: #f8f9fa;
    border-radius: 0.75rem;
    position: relative;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden; /* Hide outer overflow */
    display: flex;
    flex-direction: column;
    height: 100%; /* Ensure full height within grid */
}

/* Content header - fixed at top */
.content-header {
    padding: 1rem 1.5rem;
    background-color: #e5e7eb;
    border-bottom: 6px solid white;
    margin-bottom: 0; /* Remove margin to prevent gaps */
    border-radius: 0.75rem 0.75rem 0 0;
    flex-shrink: 0; /* Prevent header from shrinking */
    z-index: 5;
}

/* Main content area - scrollable */
.main-content {
    padding: 1rem 1.5rem 1.5rem 1.5rem;
    background-color: transparent;
    overflow-y: auto; /* Enable vertical scrolling */
    overflow-x: hidden; /* Hide horizontal overflow */
    flex: 1; /* Take remaining space */
    height: 0; /* Force flex to calculate height properly */
}

/* Scrollbar styling for better appearance */
.main-content::-webkit-scrollbar {
    width: 8px;
}

.main-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.main-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* For Firefox */
.main-content {
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

/* Ensure panels don't break the layout */
.panel {
    background-color: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    flex-shrink: 0; /* Prevent panels from shrinking */
}

/* Last panel shouldn't have bottom margin to avoid extra scroll space */
.panel:last-child {
    margin-bottom: 0;
}

/* Ensure resolution containers work well with scrolling */
.resolution-container {
    background-color: white;
    border: 1px solid var(--gray-200);
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-radius: 0.5rem;
    flex-shrink: 0;
}

.resolution-container:last-child {
    margin-bottom: 0;
}

/* Table containers should also work well with scrolling */
.table-container {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    overflow-x: auto; /* Allow horizontal scrolling for wide tables */
}

/* PDF containers should be contained within the scroll area */
.pdf-container {
    width: 100%;
    height: 600px; /* Reduced from 800px to fit better in scrollable area */
    position: relative;
    border: 1px solid var(--gray-300);
    border-radius: 0.25rem;
    overflow: hidden;
}

.pdf-container iframe {
    width: 100%;
    height: 600px; /* Match container height */
    border: none;
}

/* Mobile responsiveness for scrolling */
@media (max-width: 768px) {
    .center-column {
        height: auto;
        max-height: calc(100vh - 120px); /* Account for mobile navbar */
        border-radius: 0.5rem;
        margin: 0;
        padding: 0;
    }
    
    .main-content {
        padding: 0.5rem 1rem 1rem 1rem;
        max-height: calc(100vh - 180px); /* Adjust for mobile */
    }
    
    .pdf-container {
        height: 400px; /* Smaller on mobile */
    }
    
    .pdf-container iframe {
        height: 400px;
    }
}

/* Ensure smooth scrolling */
.main-content {
    scroll-behavior: smooth;
}

/* Add some visual feedback when scrolling is available */
.center-column::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.05));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Show shadow when content is scrollable */
.center-column.has-scroll::after {
    opacity: 1;
}

/* JavaScript will add this class when content overflows */
.has-scroll .main-content {
    padding-bottom: 2rem; /* Add extra padding when scrolling */
}

/* PDF Preview Button Visibility Control */
.show-preview {
    display: inline-flex;
}

.hide-on-preview {
    display: inline-flex;
}

.show-on-preview {
    display: none;
}

/* PDF Preview Container */
.pdf-preview-container {
    margin-top: 0.75rem;
    display: none;
    border-top: 1px solid var(--gray-200);
    padding-top: 0.75rem;
}

.pdf-preview-container.active {
    display: block;
}

/* Enhanced flex utilities for button containers */
.flex-wrap {
    flex-wrap: wrap;
}

.gap-2 {
    gap: 0.5rem;
}

.inline {
    display: inline;
}

/* Button container consistent spacing */
.preview-button-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.preview-button-container > * {
    margin: 0 !important;
}

.preview-button-container form {
    margin: 0 !important;
    display: contents;
}

.preview-button-container .btn {
    margin: 0 !important;
    flex-shrink: 0;
}

/* Responsive button behavior */
@media (max-width: 1024px) {
    .preview-button-container {
        gap: 0.375rem;
    }
}

@media (max-width: 768px) {
    .preview-button-container {
        gap: 0.25rem;
        justify-content: flex-start;
    }
    
    .preview-button-container .btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        gap: 0.2rem;
    }
}

@media (max-width: 480px) {
    .preview-button-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.375rem;
    }
    
    .preview-button-container .btn {
        width: 100%;
        justify-content: center;
    }
}