/* ==========================================================================
   ORGANIZATIONS TAB STYLES
   ========================================================================== */

.organizations-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
    padding: 0;
}

/* Header */
.organizations-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 10px;
}

.header-left h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 8px 0;
}

.header-left p {
    color: #64748b;
    margin: 0;
    font-size: 0.95rem;
}

.header-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.header-actions .btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* Filters */
.organizations-filters {
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid #e2e8f0;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
    white-space: nowrap;
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    min-width: 150px;
    transition: all 0.2s ease;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #d4a574;
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
}

/* Table Section */
.organizations-table-section {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    background: var(--glass-bg-hover);
}

.table-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.table-stats {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.table-container {
    position: relative;
    min-height: 300px;
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

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

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

/* Organizations Table */
.organizations-table {
    width: 100%;
}

.organizations-table table {
    width: 100%;
    border-collapse: collapse;
}

.organizations-table th,
.organizations-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.organizations-table th {
    background: var(--glass-bg-hover);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.organizations-table tr:hover {
    background: var(--glass-bg-hover);
}

/* Organization Info */
.organization-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.organization-name {
    font-weight: 600;
    color: var(--text-primary);
}

.organization-plan {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.organization-email,
.organization-phone,
.organization-address {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.created-date {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-active {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.2);
}

.status-inactive {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.2);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.action-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.action-btn.edit:hover {
    border-color: #007bff;
    color: #007bff;
}

.action-btn.activate:hover {
    border-color: #28a745;
    color: #28a745;
}

.action-btn.deactivate:hover {
    border-color: #ffc107;
    color: #ffc107;
}

.action-btn.categories:hover {
    border-color: #17a2b8;
    color: #17a2b8;
}

.action-btn.delete:hover {
    border-color: #dc3545;
    color: #dc3545;
}

.no-actions {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-style: italic;
}

/* No Data State */
.no-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}

.no-data-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-data h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-secondary);
}

.no-data p {
    margin: 0;
    font-size: 0.875rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--glass-bg-hover);
    color: var(--text-primary);
}

/* Organization Form */
.organization-form {
    padding: 1.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

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

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: var(--glass-bg);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

.form-group small {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.form-section {
    margin-bottom: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.form-section h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Checkbox Groups */
.checkbox-group {
    margin-bottom: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--glass-border);
    border-radius: 4px;
    background: var(--glass-bg);
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-top: 2px;
}

.checkbox-label:hover .checkmark {
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.checkbox-group small {
    margin-left: 2.75rem;
    margin-top: 0.25rem;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.modal-actions .btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    animation: slideInRight 0.3s ease;
    max-width: 400px;
}

.notification-success {
    border-left: 4px solid var(--success-color);
}

.notification-error {
    border-left: 4px solid var(--error-color);
}

.notification-info {
    border-left: 4px solid var(--primary-color);
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.notification-close:hover {
    background: var(--glass-bg-hover);
}

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

/* Responsive Design */
@media (max-width: 1200px) {
    .filters-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .organizations-container {
        padding: 1rem;
    }

    .header-main {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        justify-content: stretch;
    }

    .header-actions .btn {
        flex: 1;
    }

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

    .organizations-table table {
        min-width: 800px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
    }

    .action-buttons {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .organizations-header {
        margin-bottom: 1rem;
    }

    .organizations-filters {
        padding: 1rem;
    }

    .table-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .organizations-table th,
    .organizations-table td {
        padding: 0.75rem 0.5rem;
    }

    .action-btn {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }
}

/* ==========================================================================
   ORGANIZATIONS CARDS STYLES
   ========================================================================== */

/* Cards Container */
.organizations-cards-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cards-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.cards-header h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.cards-stats {
    color: #64748b;
    font-size: 0.9rem;
}

.organizations-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    padding: 0;
}

/* Organization Card */
.organization-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    height: fit-content;
}

.organization-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Card Header */
.organization-card-header {
    padding: 1.25rem 1.25rem 0.75rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
}

.organization-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.organization-username {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
}

/* Card Status */
.organization-card-status {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Card Details */
.organization-card-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex: 1;
}

.organization-card-detail {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    padding: 0.5rem;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 3px solid #e2e8f0;
}

.organization-card-detail i {
    width: 16px;
    color: #d4a574;
    font-size: 0.9rem;
}

.organization-card-detail-label {
    color: #64748b;
    font-weight: 500;
    min-width: 80px;
}

.organization-card-detail-value {
    color: #1e293b;
    font-weight: 500;
}

/* Card Actions */
.organization-card-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem;
    border-top: 1px solid #e2e8f0;
    margin-top: auto;
}

/* Organization action buttons inherit from global .action-btn styles */

/* Tooltips inherit from global .action-btn styles */

/* Responsive Design for Cards */
@media (max-width: 1200px) {
    .organizations-cards {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .organizations-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .organization-card {
        margin: 0;
    }

    .cards-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .organization-card-details {
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }

    .detail-item {
        font-size: 0.8rem;
    }

    .organization-card-actions .action-btn {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
    }
}
