/* Telegram Groups Dashboard - Modern Dark Theme */
:root {
    --tgd-primary: #0088cc;
    --tgd-primary-dark: #006699;
    --tgd-secondary: #3b82f6;
    --tgd-success: #10b981;
    --tgd-danger: #ef4444;
    --tgd-warning: #f59e0b;
    
    --tgd-bg-primary: #0f172a;
    --tgd-bg-secondary: #1e293b;
    --tgd-bg-tertiary: #334155;
    
    --tgd-text-primary: #f1f5f9;
    --tgd-text-secondary: #94a3b8;
    --tgd-text-muted: #64748b;
    
    --tgd-border: #475569;
    --tgd-border-light: #64748b;
    
    --tgd-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    --tgd-shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.4);
    --tgd-shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.2);
    
    --tgd-radius: 12px;
    --tgd-radius-lg: 16px;
    --tgd-radius-sm: 8px;
}

.tgd-dashboard {
   /*  max-width: 1800px;  */
    margin: 0 auto;
    /* padding: 2rem; */
    background: var(--tgd-bg-primary);
    color: var(--tgd-text-primary);
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    min-height: 100vh;
    border-radius: 16px;
    line-height: 1.6;
}

/* Header */
.tgd-dashboard-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.tgd-dashboard-header h1 {
    font-size: 3em;
    margin: 0 0 10px 0;
    background: linear-gradient(45deg, #5865f2, #eb459e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tgd-dashboard-header p {
    font-size: 1.2em;
    opacity: 0.8;
    margin-bottom: 20px;
}

/* Statistics Widget */
.tgd-stats-widget {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.tgd-stat-card {
    background: linear-gradient(135deg, var(--tgd-bg-secondary), var(--tgd-bg-tertiary));
    border: 1px solid var(--tgd-border);
    border-radius: var(--tgd-radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
    box-shadow: var(--tgd-shadow-sm);
}

.tgd-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--tgd-shadow);
    border-color: var(--tgd-primary);
}

.tgd-stat-icon {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tgd-bg-primary);
    border-radius: 50%;
    border: 2px solid var(--tgd-primary);
}

.tgd-stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--tgd-primary);
    line-height: 1;
}

.tgd-stat-label {
    font-size: 0.9rem;
    color: var(--tgd-text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Modern CSS Loader */
.tgd-modern-loader {
    width: 48px;
    height: 48px;
    border: 3px solid var(--tgd-border);
    border-bottom-color: var(--tgd-primary);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: tgd-rotation 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes tgd-rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced Progress Bars for Voting */
.tgd-progress-bar {
    width: 100%;
    height: 12px;
    background: var(--tgd-bg-primary);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.5rem;
    border: 1px solid var(--tgd-border);
    display: flex; /* Key change: allows two bars side by side */
}

.tgd-progress-fill-legit {
    height: 100%;
    background: linear-gradient(135deg, var(--tgd-success), #059669);
    transition: width 0.5s ease;
}

.tgd-progress-fill-scam {
    height: 100%;
    background: linear-gradient(135deg, var(--tgd-danger), #dc2626);
    transition: width 0.5s ease;
}

.tgd-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.tgd-progress-percent-legit {
    color: var(--tgd-success);
    font-weight: 600;
}

.tgd-progress-percent-scam {
    color: var(--tgd-danger);
    font-weight: 600;
}

.tgd-progress-total {
    color: var(--tgd-text-muted);
    font-size: 0.75rem;
}

/* Buttons */
.tgd-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--tgd-radius);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    line-height: 1;
}

.tgd-btn-primary {
    background: linear-gradient(135deg, var(--tgd-primary), var(--tgd-primary-dark));
    color: white;
    box-shadow: var(--tgd-shadow-sm);
}

.tgd-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--tgd-shadow);
}

.tgd-btn-secondary {
    background: var(--tgd-bg-tertiary);
    color: var(--tgd-text-primary);
    border: 1px solid var(--tgd-border);
}

.tgd-btn-secondary:hover {
    background: var(--tgd-bg-secondary);
    transform: translateY(-1px);
}

.tgd-btn-block {
    width: 100%;
    justify-content: center;
}

.tgd-add-btn {
    white-space: nowrap;
}

/* Modal */
.tgd-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.tgd-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.tgd-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--tgd-bg-secondary);
    border-radius: var(--tgd-radius-lg);
    padding: 2.5rem;
    width: 90%;
    max-width: 500px;
    border: 1px solid var(--tgd-border);
    box-shadow: var(--tgd-shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.tgd-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.tgd-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--tgd-text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tgd-modal-close {
    background: none;
    border: none;
    color: var(--tgd-text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--tgd-radius-sm);
    transition: all 0.2s ease;
}

.tgd-modal-close:hover {
    color: var(--tgd-danger);
    background: var(--tgd-bg-tertiary);
}

/* Forms */
.tgd-form-group {
    margin-bottom: 1.5rem;
}

.tgd-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--tgd-text-primary);
    font-size: 0.9rem;
}

.tgd-input,
.tgd-textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--tgd-border);
    border-radius: var(--tgd-radius);
    background: var(--tgd-bg-primary);
    color: var(--tgd-text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.tgd-input:focus,
.tgd-textarea:focus {
    outline: none;
    border-color: var(--tgd-primary);
    box-shadow: 0 0 0 3px rgba(0, 136, 204, 0.1);
}

.tgd-textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

/* Controls */
.tgd-controls {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    align-items: center;
    background: var(--tgd-bg-secondary);
    padding: 1.5rem;
    border-radius: var(--tgd-radius);
    border: 1px solid var(--tgd-border);
}

.tgd-search {
    flex: 1;
    min-width: 300px;
}

.tgd-search-wrapper {
    position: relative;
}

.tgd-search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tgd-text-muted);
    font-size: 1.1rem;
}

.tgd-search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 1px solid var(--tgd-border);
    border-radius: var(--tgd-radius);
    background: var(--tgd-bg-primary);
    color: var(--tgd-text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.tgd-search-input:focus {
    outline: none;
    border-color: var(--tgd-primary);
    box-shadow: 0 0 0 3px rgba(0, 136, 204, 0.1);
}

.tgd-filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.tgd-select {
    padding: 0.875rem 1rem;
    border: 1px solid var(--tgd-border);
    border-radius: var(--tgd-radius);
    color: var(--tgd-text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 150px;
    transition: all 0.3s ease;
}

.tgd-select:focus {
    outline: none;
    border-color: var(--tgd-primary);
}

/* Groups Grid */
.tgd-groups-container {
    margin-bottom: 3rem;
}

.tgd-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Cards */
.tgd-card {
    background: var(--tgd-bg-secondary);
    border-radius: var(--tgd-radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--tgd-border);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: var(--tgd-shadow-sm);
}

.tgd-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--tgd-border);
}

.tgd-card-legit::before {
    background: linear-gradient(135deg, var(--tgd-success), #059669);
}

.tgd-card-scam::before {
    background: linear-gradient(135deg, var(--tgd-danger), #dc2626);
}

.tgd-card-popular::before {
    background: linear-gradient(135deg, var(--tgd-warning), #d97706);
}

.tgd-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--tgd-shadow);
    border-color: var(--tgd-primary);
}

.tgd-card-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    gap: 1rem;
}

.tgd-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--tgd-bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    overflow: hidden;
    border: 3px solid var(--tgd-primary);
    flex-shrink: 0;
}

.tgd-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tgd-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tgd-card-info {
    flex: 1;
}

.tgd-card-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
    color: var(--tgd-text-primary);
    line-height: 1.3;
}

.tgd-card-username {
    font-size: 0.9rem;
    color: var(--tgd-text-secondary);
    margin: 0 0 0.75rem 0;
}

.tgd-members {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.tgd-member-count,
.tgd-online-count {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--tgd-bg-primary);
    padding: 0.375rem 0.75rem;
    border-radius: var(--tgd-radius-sm);
    font-size: 0.85rem;
}

.tgd-member-count {
    color: var(--tgd-primary);
}

.tgd-online-count {
    color: var(--tgd-success);
}

.tgd-card-description {
    margin-bottom: 1.25rem;
    line-height: 1.5;
    color: var(--tgd-text-secondary);
    background: var(--tgd-bg-primary);
    padding: 1rem;
    border-radius: var(--tgd-radius);
    border-left: 3px solid var(--tgd-primary);
    font-size: 0.95rem;
}

/* Stats */
.tgd-stats {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.tgd-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    background: var(--tgd-bg-primary);
    padding: 0.75rem;
    border-radius: var(--tgd-radius);
    text-align: center;
}

.tgd-stat-legit {
    border-top: 2px solid var(--tgd-success);
}

.tgd-stat-scam {
    border-top: 2px solid var(--tgd-danger);
}

.tgd-stat-comments {
    border-top: 2px solid var(--tgd-primary);
}

.tgd-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.tgd-stat-legit .tgd-stat-value {
    color: var(--tgd-success);
}

.tgd-stat-scam .tgd-stat-value {
    color: var(--tgd-danger);
}

.tgd-stat-comments .tgd-stat-value {
    color: var(--tgd-primary);
}

.tgd-stat-label {
    font-size: 0.75rem;
    color: var(--tgd-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Actions */
.tgd-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.tgd-actions .tgd-btn {
    flex: 1;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

/* Meta */
.tgd-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--tgd-text-muted);
    padding-top: 0.75rem;
    border-top: 1px solid var(--tgd-border);
    justify-content: center;
}

/* Pagination */
.tgd-pagination-container {
    display: flex;
    justify-content: center;
}

.tgd-pagination {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tgd-page-btn {
    padding: 0.75rem 1rem;
    border: 1px solid var(--tgd-border);
    background: var(--tgd-bg-secondary);
    color: var(--tgd-text-primary);
    border-radius: var(--tgd-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9rem;
}

.tgd-page-btn:hover {
    background: var(--tgd-bg-tertiary);
    border-color: var(--tgd-primary);
}

.tgd-page-active {
    background: var(--tgd-primary);
    border-color: var(--tgd-primary);
    color: white;
}

/* Loading & States */
.tgd-loading {
    text-align: center;
    padding: 3rem 2rem;
    grid-column: 1 / -1;
}

.tgd-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--tgd-border);
    border-top: 3px solid var(--tgd-primary);
    border-radius: 50%;
    animation: tgd-spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes tgd-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.tgd-empty {
    text-align: center;
    padding: 4rem 2rem;
    font-size: 1.1rem;
    color: var(--tgd-text-secondary);
    background: var(--tgd-bg-secondary);
    border-radius: var(--tgd-radius);
    border: 1px solid var(--tgd-border);
    grid-column: 1 / -1;
}

/* Messages */
.tgd-message {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    padding: 1rem 1.5rem;
    border-radius: var(--tgd-radius);
    color: white;
    font-weight: 600;
    box-shadow: var(--tgd-shadow);
    animation: tgd-slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tgd-message-success {
    background: linear-gradient(135deg, var(--tgd-success), #059669);
}

.tgd-message-error {
    background: linear-gradient(135deg, var(--tgd-danger), #dc2626);
}

@keyframes tgd-slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Icons */
.tgd-icon {
    font-style: normal;
}

/* Voting Button Styles */
.tgd-voting-section {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--tgd-bg-primary);
    border-radius: var(--tgd-radius);
    border: 1px solid var(--tgd-border);
}

.tgd-voting-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--tgd-text-secondary);
    margin-bottom: 0.75rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tgd-vote-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.tgd-vote-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: var(--tgd-radius);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.tgd-vote-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.tgd-vote-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.tgd-vote-legit {
    background: linear-gradient(135deg, var(--tgd-success), #059669);
    color: white;
}

.tgd-vote-legit:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669, #047857);
}

.tgd-vote-scam {
    background: linear-gradient(135deg, var(--tgd-danger), #dc2626);
    color: white;
}

.tgd-vote-scam:hover:not(:disabled) {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.tgd-voting-loading {
    position: relative;
    color: transparent !important;
}

.tgd-voting-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: tgd-spin 1s linear infinite;
}

/* Card status indicators */
.tgd-card-legit {
    border-left: 4px solid var(--tgd-success);
    border-right: 4px solid var(--tgd-success);
}

.tgd-card-scam {
    border-left: 4px solid var(--tgd-danger);
    border-right: 4px solid var(--tgd-danger);
}

.tgd-card-neutral {
    border-left: 4px solid var(--tgd-border);
}

/* Button Container */
.tgd-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.tgd-add-server-btn {
    padding: 12px 25px;
    background: linear-gradient(45deg, #5865f2, #4752c4);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.tgd-add-server-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(88, 101, 242, 0.4);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .tgd-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
}

@media (max-width: 768px) {
    .tgd-dashboard {
        padding: 1rem;
    }
    
    .tgd-stats-widget {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
	
	.tgd-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
    
    .tgd-stat-card {
        padding: 1rem;
    }
	
	.tgd-stat {
    min-width: 30%;
    flex: 0 1 auto;
  }
    
    .tgd-stat-icon {
        font-size: 1.5rem;
        width: 50px;
        height: 50px;
    }
    
    .tgd-stat-value {
        font-size: 1.5rem;
    }
    
    .tgd-grid {
        grid-template-columns: 1fr;
    }
    
    .tgd-controls {
        flex-direction: column;
    }
    
    .tgd-search {
        min-width: auto;
        width: 100%;
    }
    
    .tgd-filters {
        width: 100%;
        justify-content: stretch;
    }
    
    .tgd-filters .tgd-select {
        flex: 1;
        min-width: 0;
    }
    
    .tgd-modal-content {
        width: 95%;
        padding: 1.5rem;
    }
    
     .tgd-card-header {
    display: flex;
    flex-direction: row; /* Подрежда снимката и текста на един ред */
    align-items: flex-start; /* Подравнява елементите отгоре */
    text-align: left;
    gap: 1rem;
    margin-bottom: 1rem;
  }
    
    .tgd-avatar {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }
    
    .tgd-stats {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
    
    .tgd-actions {
        flex-direction: column;
    }
	
	  /* Ensure card info takes full width */
  .tgd-card-info {
    flex: 1; /* Текстовата част заема останалото пространство */
    min-width: 0; /* Позволява на текста да свива */
  }
  
   /* Ensure progress elements stay on one line */
  .tgd-progress-percent-legit,
  .tgd-progress-total, 
  .tgd-progress-percent-scam {
    white-space: nowrap;
    font-size: 0.75rem;
  }
  
  .tgd-members {
    display: flex;
    flex-direction: column; /* Подрежда "членове" и "онлайн" вертикално */
    gap: 0.25rem;
        margin-top: -50px;
        margin-left: 122px;
  }
  
  .tgd-card-title {
    margin-left: 20px;
    margin-top: 5px;
}


.tgd-card-username {
    margin-left: 20px;
}
  
  .tgd-member-count,
  .tgd-online-count {
    justify-content: flex-start; /* Подравнява иконките и текста в ляво */
    background: transparent; /* Премахва фоновата кутия */
    padding: 0.25rem 0;
  }
    
    .tgd-progress-labels {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
    .tgd-stats-widget {
        grid-template-columns: 1fr;
    }
    
    .tgd-card {
        padding: 1rem;
    }
    
    .tgd-members {
    justify-content: center;
    gap: 0.5rem;
  }
    
    /* Compact voting section */
  .tgd-progress-labels {
    font-size: 0.7rem;
    gap: 0.25rem;
  }

  /* Better button sizing */
  .tgd-vote-buttons {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .tgd-card-header {
    gap: 0.75rem;
  }
  .tgd-avatar {
    width: 50px;
    height: 50px;
  }

  .tgd-vote-btn {
    min-width: 45%;
    flex: 0 1 auto;
  }
    
    .tgd-voting-section {
        padding: 0.875rem;
    }
    
    .tgd-button-container {
        flex-direction: column;
        width: 100%;
    }
    
    .tgd-add-server-btn {
        width: 100%;
    }
}