/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* Login Container */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.login-card h1 {
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.login-card p {
    color: #666;
    margin-bottom: 2rem;
}

.google-signin-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: white;
    color: #333;
    border: 2px solid #e0e0e0;
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    justify-content: center;
}

.google-signin-btn:hover {
    border-color: #4285f4;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.2);
    transform: translateY(-2px);
}

.google-signin-btn svg {
    flex-shrink: 0;
}

/* Dashboard Container */
.dashboard-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #667eea;
    font-size: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #667eea;
}

.signout-btn {
    background: #f5f7fa;
    border: 1px solid #e0e0e0;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.signout-btn:hover {
    background: #e0e0e0;
}

/* Tabs */
.tabs {
    background: white;
    border-bottom: 2px solid #e0e0e0;
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.tab {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    margin-bottom: -2px;
}

.tab:hover {
    color: #667eea;
    background: #f5f7fa;
}

.tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    flex: 1;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tab-header h2 {
    color: #333;
    font-size: 1.75rem;
}

/* Buttons */
.btn-primary {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f5f7fa;
    color: #333;
    border: 1px solid #e0e0e0;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-danger {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-edit {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-edit:hover {
    background: #2563eb;
}

/* Data List */
.data-list {
    display: grid;
    gap: 1rem;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1.1rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #999;
    font-size: 1.1rem;
}

/* Card Styles */
.card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.card-subtitle {
    font-size: 0.9rem;
    color: #666;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.card-body {
    color: #555;
    line-height: 1.8;
}

.card-info {
    display: grid;
    gap: 0.5rem;
}

.card-info-item {
    display: flex;
    gap: 0.5rem;
}

.card-info-label {
    font-weight: 600;
    color: #666;
    min-width: 100px;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

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

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

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

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

.status-draft {
    background: #f3f4f6;
    color: #374151;
}

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

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

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

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

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

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

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

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

.modal-header h2 {
    color: #333;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #f5f7fa;
    color: #333;
}

/* Forms */
form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

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

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 0.5rem;
}

.badge-individual {
    background-color: #e3f2fd;
    color: #1976d2;
}

.badge-company {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

/* Contacts Section */
.contacts-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e0e0e0;
}

.contacts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.contacts-header h3 {
    font-size: 1.1rem;
    color: #333;
}

.contacts-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.contact-card {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: all 0.2s ease;
}

.contact-card:hover {
    background: #f0f0f0;
    border-color: #d0d0d0;
}

.contact-info {
    flex: 1;
}

.contact-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.contact-title {
    font-size: 0.875rem;
    color: #666;
    font-style: italic;
    margin-bottom: 0.25rem;
}

.contact-detail {
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.25rem;
}

.contact-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-edit-small,
.btn-danger-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn-edit-small {
    background-color: #667eea;
    color: white;
}

.btn-edit-small:hover {
    background-color: #5568d3;
}

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

.btn-danger-small:hover {
    background-color: #d32f2f;
}

/* Small Modal */
.modal-small {
    max-width: 500px;
}

/* Large Modal */
.modal-large {
    max-width: 800px;
}

/* Organization Settings */
.settings-info {
    background: white;
    border-radius: 8px;
    padding: 2rem;
}

.organization-display {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.org-section h3 {
    color: #667eea;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.org-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.org-detail-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.org-detail-item:last-child {
    border-bottom: none;
}

.org-detail-item strong {
    color: #555;
    margin-right: 0.5rem;
}

.org-detail-item a {
    color: #667eea;
    text-decoration: none;
}

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

/* Authorized Emails */
.authorized-emails-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
}

.add-email-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.add-email-form input {
    flex: 1;
}

.authorized-emails-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.authorized-email-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.authorized-email-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.authorized-email-address {
    font-family: monospace;
    color: #333;
}

.badge-admin {
    background-color: #ffeaa7;
    color: #d63031;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .tabs {
        padding: 0 1rem;
        overflow-x: auto;
    }

    .main-content {
        padding: 1rem;
    }

    .tab-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

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

    .user-info {
        flex-wrap: wrap;
        justify-content: center;
    }

    .card-header {
        flex-direction: column;
        gap: 1rem;
    }

    .card-actions {
        width: 100%;
        justify-content: stretch;
    }

    .card-actions button {
        flex: 1;
    }
}
