* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
}

header h1 {
    margin-bottom: 15px;
    font-size: 28px;
}

nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.nav-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
}

main {
    padding: 30px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e8eaed;
}

.modal-header h2 {
    margin: 0;
    color: #202124;
    font-size: 24px;
    font-weight: 400;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #5f6368;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f1f3f4;
    color: #202124;
}

.ticket-type-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid #e8eaed;
    padding-bottom: 15px;
}

.ticket-type-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    color: #5f6368;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    font-weight: 500;
}

.ticket-type-btn:hover {
    color: #667eea;
}

.ticket-type-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.ticket-form {
    display: none;
}

.ticket-form.active {
    display: block;
}

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

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

.create-ticket-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.create-ticket-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.create-ticket-btn:active {
    transform: translateY(0);
}

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.ticket-form h2 {
    margin-bottom: 25px;
    color: #333;
    font-size: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-success:disabled {
    background: #6c757d;
    color: white;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-success:disabled:hover {
    background: #6c757d;
    transform: none;
    box-shadow: none;
}

.message {
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
    display: none;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.filter-section {
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-section h2 {
    margin-right: auto;
    color: #333;
    margin: 0;
}

.filter-btn {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #202124;
    transition: all 0.3s;
}

.filter-btn:hover {
    background: #e9ecef;
}

.filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.tickets-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    padding: 20px 0;
}

.ticket-section {
    grid-column: 1 / -1;
    margin-bottom: 10px;
}

.ticket-section h3 {
    margin-bottom: 12px;
    color: #5f6368;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ticket-card {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    min-height: 120px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
    border-left: 4px solid transparent;
}

.ticket-card:hover {
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
    transform: translateY(-2px);
}

.ticket-card.repair {
    border-left-color: #fbbc04;
}

.ticket-card.request {
    border-left-color: #34a853;
}

.ticket-card.installation {
    border-left-color: #4285f4;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 8px;
}

.ticket-header > div {
    flex: 1;
}

.ticket-header h3 {
    color: #202124;
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 4px 0;
    line-height: 1.4;
}

.ticket-id {
    display: inline-block;
    font-size: 11px;
    color: #5f6368;
    background: #f1f3f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    font-family: 'Courier New', monospace;
}

.status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.status-open {
    background: #fef3c7;
    color: #92400e;
}

.status-in-progress {
    background: #dbeafe;
    color: #1e40af;
}

.status-closed {
    background: #d1fae5;
    color: #065f46;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-support {
    background: #e0e7ff;
    color: #3730a3;
}

.status-assigned {
    background: #fef3c7;
    color: #92400e;
}

.status-accepted {
    background: #d1fae5;
    color: #065f46;
}

.status-declined {
    background: #fee2e2;
    color: #991b1b;
}

.status-uncompleted {
    background: #fef7e0;
    color: #b06000;
}

.status-completed {
    background: #dbeafe;
    color: #1e40af;
}

.ticket-management-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #e8eaed;
}

.ticket-management-section h2 {
    margin-bottom: 20px;
    color: #202124;
    font-size: 22px;
    font-weight: 400;
}

.ticket-body {
    flex: 1;
    margin-bottom: 12px;
    color: #5f6368;
    font-size: 14px;
    line-height: 1.5;
}

.ticket-body p {
    margin: 0 0 6px 0;
    color: #5f6368;
    line-height: 1.5;
    word-wrap: break-word;
}

.ticket-body p:last-child {
    margin-bottom: 0;
}

.ticket-body strong {
    color: #202124;
    font-weight: 500;
}

.ticket-type-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.ticket-type-badge.repair {
    background: #fef3c7;
    color: #92400e;
}

.ticket-type-badge.request {
    background: #d1fae5;
    color: #065f46;
}

.ticket-type-badge.installation {
    background: #dbeafe;
    color: #1e40af;
}

.ticket-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #e8eaed;
}

.ticket-actions select {
    padding: 6px 10px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    background: white;
    color: #202124;
    flex: 1;
}

.ticket-actions select:focus {
    outline: none;
    border-color: #4285f4;
}

.ticket-actions select:disabled {
    background-color: #f5f5f5;
    border-color: #e0e0e0;
    color: #757575;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Status Switch Dropdown - Unified style */
.status-switch-dropdown {
    flex: 0 1 auto;
    min-width: 180px;
    padding: 8px 12px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    color: #202124;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.status-switch-dropdown:hover {
    background-color: #f8f9fa;
    border-color: #4285f4;
}

.status-switch-dropdown:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
    background-color: white;
}

.status-switch-dropdown option {
    background-color: white;
    color: #333;
    padding: 8px;
}

/* Ticket Manager: actions block (dropdown + Assign) on own row, full width */
.ticket-manager-actions-wrap .status-switch-dropdown {
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

/* Send to Dropdown - Same style as Status Switch */
.send-to-dropdown {
    flex: 1;
    min-width: 150px;
    padding: 8px 12px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    color: #202124;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.send-to-dropdown:hover {
    background-color: #f8f9fa;
    border-color: #4285f4;
}

.send-to-dropdown:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
    background-color: white;
}

.send-to-dropdown:disabled {
    background-color: #e0e0e0;
    border-color: #bdbdbd;
    color: #757575;
    cursor: not-allowed;
}

.send-to-dropdown option {
    background-color: white;
    color: #333;
    padding: 8px;
}

.ticket-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Hashtag styles */
.hashtags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-height: 50px;
    background: #f9f9f9;
}

.hashtag-tag {
    padding: 5px 10px;
    background: #007bff;
    color: white;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    user-select: none;
    transition: all 0.2s;
    display: inline-block;
}

.hashtag-tag:hover {
    background: #0056b3;
    transform: scale(1.05);
}

.hashtag-tag.selected {
    background: #28a745;
    opacity: 0.8;
}

/* Hashtag styles */
.hashtags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-height: 50px;
    background: #f9f9f9;
}

.hashtag-tag {
    padding: 5px 10px;
    background: #007bff;
    color: white;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    user-select: none;
    transition: all 0.2s;
    display: inline-block;
}

.hashtag-tag:hover {
    background: #0056b3;
    transform: scale(1.05);
}

.hashtag-tag.selected {
    background: #28a745;
    opacity: 0.8;
}

.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-card h3 {
    font-size: 14px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.stat-card p {
    font-size: 32px;
    font-weight: bold;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.empty {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
}

@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 8px;
    }

    header {
        padding: 15px 20px;
    }

    main {
        padding: 20px;
    }

    .ticket-tabs {
        flex-direction: column;
    }

    .filter-section {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-section {
        grid-template-columns: 1fr;
    }

    .tickets-container {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) and (max-width: 1200px) {
    .tickets-container {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (min-width: 1400px) {
    .tickets-container {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

/* Team Manager Styles */
.team-manager-container {
    padding: 20px;
}

.team-manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.team-manager-header h2 {
    margin: 0;
    color: #202124;
}

.team-manager-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.unassigned-members-section h3,
.teams-section h3 {
    margin-bottom: 15px;
    color: #202124;
    font-size: 18px;
}

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

.members-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    min-height: 100px;
    border: 2px dashed #ddd;
}

.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.team-folder {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    min-height: 200px;
    transition: all 0.3s;
}

.team-folder:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.team-folder.drag-over {
    border-color: #667eea;
    background: #f0f4ff;
}

.team-folder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.team-folder-header h4 {
    margin: 0;
    color: #202124;
    font-size: 16px;
}

.team-folder-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 150px;
}

.member-card {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    transition: all 0.2s;
}

.member-card:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.member-card[draggable="true"] {
    cursor: grab;
}

.member-card:active {
    cursor: grabbing;
}

.member-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.member-info strong {
    color: #202124;
    font-size: 14px;
}

.member-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}

.member-status.available {
    background: #d4edda;
    color: #155724;
}

.member-status.busy {
    background: #f8d7da;
    color: #721c24;
}

.member-actions {
    display: flex;
    gap: 5px;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
    min-width: auto;
}

.empty-message {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}
