/* Reset und Basis */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #ffffff;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: #B80D38;
    color: white;
    padding: 15px 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.header-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.header-link {
    color: white;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s;
    font-size: 0.9rem;
}

.header-link:hover {
    background-color: rgba(255,255,255,0.1);
}

/* Menu Dropdown */
.menu-dropdown {
    position: relative;
    display: inline-block;
}

.menu-btn {
    background: none;
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s;
    font-size: 0.9rem;
    cursor: pointer;
}

.menu-btn:hover {
    background-color: rgba(255,255,255,0.1);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: white;
    min-width: 160px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    border-radius: 6px;
    z-index: 1000;
    border: 1px solid #E5E7EB;
    overflow: hidden;
}

.dropdown-content.show {
    display: block;
}

.dropdown-content a {
    color: #374151;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.dropdown-content a:hover {
    background-color: #F3F4F6;
}

.dropdown-content a:first-child {
    border-bottom: 1px solid #E5E7EB;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.profile-image {
    width: 40px;
    height: 40px;
    background: #8A0D33;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.user-name {
    font-weight: 500;
    display: block;
}

/* Admin Header */
.admin-header {
    background: #8A0D33;
}

.back-btn {
    color: white;
    text-decoration: none;
    margin-right: 15px;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.back-btn:hover {
    background-color: rgba(255,255,255,0.1);
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 20px;
    padding: 10px 0;
    color: #6B7280;
    font-size: 0.9rem;
}

.breadcrumb-link {
    color: #B80D38;
    text-decoration: none;
}

.breadcrumb-link:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    margin: 0 8px;
}

.breadcrumb-current {
    color: #374151;
    font-weight: 500;
}

/* Main Content */
.main-content {
    padding: 30px 0;
    background: #ffffff;
}

.welcome-section {
    text-align: center;
    margin-bottom: 40px;
}

.welcome-section h2 {
    font-size: 2rem;
    color: #1F2937;
    margin-bottom: 10px;
}

.welcome-section p {
    color: #6B7280;
    font-size: 1.1rem;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.tool-card {
    background: white;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #E5E7EB;
    transition: box-shadow 0.2s ease;
    text-align: center;
}

.tool-card:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.tool-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.tool-card h3 {
    color: #1F2937;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.tool-card p {
    color: #6B7280;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.admin-tool {
    border-color: #374151;
}

.admin-tool:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.btn-primary {
    background: #B80D38;
    color: white;
}

.btn-primary:hover {
    background: #A20C32;
}

.btn-admin {
    background: #8A0D33;
    color: white;
}

.btn-admin:hover {
    background: #7A0B2E;
}

.btn-success {
    background: #10B981;
    color: white;
}

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

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

.btn-secondary:hover {
    background: #4B5563;
}

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

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

.btn-view {
    background: #3B82F6;
    color: white;
}

.btn-view:hover {
    background: #2563EB;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-full {
    width: 100%;
}

/* Login Page */
.login-page {
    background: #ffffff;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: #B80D38;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid #A20C32;
    color: white;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    height: 80px;
    width: auto;
    object-fit: contain;
    margin-bottom: 15px;
    filter: brightness(0) invert(1);
}

.login-header h1 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 5px;
    font-weight: bold;
}

.login-header p {
    color: rgba(255,255,255,0.9);
    font-size: 1.1rem;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.3);
}

.admin-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    background: rgba(255,255,255,0.1);
    padding: 8px 16px;
    border-radius: 4px;
    display: inline-block;
    transition: background-color 0.2s;
}

.admin-link:hover {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* Login Form Styling */
.login-form .form-group label {
    color: white;
    font-weight: 500;
    margin-bottom: 8px;
}

.login-form .form-group input {
    background: rgba(255,255,255,0.95);
    border: 1px solid rgba(255,255,255,0.3);
    color: #333;
}

.login-form .form-group input:focus {
    background: white;
    border-color: white;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
}

.login-form .btn-primary {
    background: white;
    color: #B80D38;
    font-weight: bold;
    border: none;
}

.login-form .btn-primary:hover {
    background: rgba(255,255,255,0.9);
    color: #A20C32;
}

.error-message {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
}

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

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

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: #B80D38;
    box-shadow: 0 0 0 2px rgba(184, 13, 56, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

.disabled-input {
    background-color: #F3F4F6 !important;
    color: #6B7280 !important;
    cursor: not-allowed;
}

/* Messages */
.message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
}

.message.success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #10B981;
}

.message.error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #EF4444;
}

/* Profile & Settings Styles */
.profile-grid {
    display: grid;
    gap: 25px;
    grid-template-columns: 1fr 1fr;
}

.profile-section {
    background: white;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #E5E7EB;
}

.profile-section h2 {
    color: #1F2937;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.account-info .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #F3F4F6;
}

.account-info .info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 500;
    color: #374151;
}

.info-value {
    color: #6B7280;
}

.admin-badge {
    color: #B80D38 !important;
    font-weight: bold;
}

.user-badge {
    color: #059669 !important;
}

.status-active {
    color: #059669 !important;
}

/* Contacts Styles */
.contacts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.contacts-filters {
    flex: 1;
}

.filter-row {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.search-group, .filter-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-group input, .filter-group select {
    min-width: 200px;
}

/* View Controls */
.view-toggle {
    display: flex;
    gap: 5px;
    margin-left: auto;
}

/* Filters */
.column-filter, .cards-filter {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #E5E7EB;
}

.filter-section {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-toggle-btn {
    background: #F3F4F6;
    border: 1px solid #D1D5DB;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.filter-toggle-btn:hover {
    background: #E5E7EB;
}

.checkbox-container {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #E5E7EB;
}

.filter-label {
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
}

.checkbox-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.checkbox-group .checkbox-label {
    font-weight: normal;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.contact-form {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #E5E7EB;
}

.form-section h3 {
    color: #1F2937;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

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

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

.contact-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #E5E7EB;
    transition: box-shadow 0.2s ease;
}

.contact-card:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

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

.contact-name h3 {
    margin: 0 0 5px 0;
    color: #1F2937;
    font-size: 1.1rem;
}

.contact-category {
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.member-badge {
    background: #FEE2E2;
    color: #B80D38;
}

.contact-badge {
    background: #E0F2FE;
    color: #0369A1;
}

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

.contact-details {
    font-size: 0.9rem;
}

.contact-row {
    display: flex;
    margin-bottom: 8px;
    align-items: flex-start;
}

.contact-label {
    font-weight: 500;
    color: #374151;
    min-width: 70px;
    margin-right: 10px;
}

.contact-row a {
    color: #B80D38;
    text-decoration: none;
}

.contact-row a:hover {
    text-decoration: underline;
}

.no-contacts {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #6B7280;
}

/* Tables */
.contacts-table {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

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

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

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

#contactsTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

table th, table td, #contactsTable th, #contactsTable td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #E5E7EB;
    vertical-align: top;
}

table th, #contactsTable th {
    background: #F9FAFB;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #E5E7EB;
    white-space: nowrap;
}

table tr:hover, #contactsTable tr:hover {
    background: #F9FAFB;
}

.table-actions {
    display: flex;
    gap: 5px;
    white-space: nowrap;
}

.member-indicator {
    margin-left: 8px;
    font-size: 0.75rem;
    background: #FEE2E2;
    color: #B80D38;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.no-data {
    color: #9CA3AF;
    font-style: italic;
}

.category-badge {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
    display: inline-block;
}

.notes-preview {
    cursor: help;
    font-size: 0.85rem;
}

/* Column specific widths */
.col-name {
    min-width: 180px;
}

.col-email {
    min-width: 200px;
}

.col-phone, .col-mobile {
    min-width: 130px;
}

.col-address {
    min-width: 220px;
}

.col-company {
    min-width: 160px;
}

.col-category {
    min-width: 110px;
}

.col-notes {
    min-width: 150px;
    max-width: 200px;
}

.col-actions {
    min-width: 120px;
    text-align: center;
}

/* Admin Sections */
.admin-grid {
    display: grid;
    gap: 30px;
}

.admin-section {
    background: white;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #E5E7EB;
}

.admin-section h2 {
    color: #1F2937;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #1F2937;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6B7280;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #374151;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #E5E7EB;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.contact-details-grid {
    display: grid;
    gap: 15px;
}

.detail-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 15px;
    align-items: start;
}

.detail-row strong {
    color: #374151;
    font-weight: 600;
}

.detail-row a {
    color: #B80D38;
    text-decoration: none;
}

.detail-row a:hover {
    text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header .container {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-left {
        justify-content: center;
        gap: 10px;
    }
    
    .header-logo {
        height: 35px;
    }
    
    .header h1 {
        font-size: 1.3rem;
    }
    
    .header-right {
        justify-content: center;
        gap: 10px;
    }
    
    .user-name {
        display: none;
    }
    
    .dropdown-content {
        right: 50%;
        transform: translateX(50%);
    }
    
    .main-content {
        padding: 20px 0;
    }
    
    .welcome-section h2 {
        font-size: 1.5rem;
    }
    
    .welcome-section p {
        font-size: 1rem;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .tool-card {
        padding: 20px;
    }
    
    .tool-icon {
        font-size: 2.5rem;
    }
    
    .tool-card h3 {
        font-size: 1.2rem;
    }
    
    .profile-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .contacts-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-group, .filter-group {
        flex-direction: column;
    }
    
    .search-group input, .filter-group select {
        min-width: auto;
        width: 100%;
    }
    
    .view-toggle {
        justify-content: flex-start;
        margin-left: 0;
        margin-top: 10px;
    }
    
    .filter-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .checkbox-group {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        width: 100%;
    }
    
    .contacts-grid {
        grid-template-columns: 1fr;
    }
    
    .contact-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .contact-actions {
        align-self: flex-end;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .login-container {
        padding: 15px;
    }
    
    .login-box {
        padding: 30px 20px;
    }
    
    .login-logo {
        height: 60px;
        filter: brightness(0) invert(1);
    }
    
    .login-header h1 {
        font-size: 2rem;
        color: white;
    }
    
    .admin-grid {
        gap: 20px;
    }
    
    .admin-section {
        padding: 20px;
    }
    
    .users-table {
        overflow-x: auto;
    }
    
    table {
        font-size: 0.9rem;
        min-width: 600px;
    }
    
    table th, table td {
        padding: 8px 4px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .btn-small {
        padding: 5px 10px;
        font-size: 0.8rem;
    }
    
    /* Table responsive */
    .table-container {
        font-size: 0.8rem;
    }
    
    #contactsTable th,
    #contactsTable td {
        padding: 8px 4px;
    }
    
    .col-address, .col-company {
        max-width: 150px;
        word-wrap: break-word;
    }
    
    /* Modal responsive */
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .detail-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    
    .modal-body {
        max-height: 50vh;
    }
    
    .modal-footer {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .header-left {
        flex-direction: column;
        gap: 5px;
    }
    
    .header-logo {
        height: 30px;
    }
    
    .header h1 {
        font-size: 1.1rem;
    }
    
    .welcome-section h2 {
        font-size: 1.3rem;
    }
    
    .tool-card {
        padding: 15px;
    }
    
    .tool-icon {
        font-size: 2rem;
    }
    
    .tool-card h3 {
        font-size: 1.1rem;
    }
    
    .login-logo {
        height: 50px;
        filter: brightness(0) invert(1);
    }
    
    .login-header h1 {
        font-size: 1.8rem;
        color: white;
    }
    
    .profile-image {
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
    }
}