/* Common Styles for RapidSOS Communicator */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #000000;
    color: #ffffff;
    min-height: 100vh;
    padding: 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s, color 0.3s;
}

/* Light theme styles */
html.light-theme body {
    background: #ffffff;
    color: #000000;
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

h1 {
    color: #ffffff;
    font-size: 1.875rem;
    line-height: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
}

.subtitle {
    color: #9ca3af;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1rem;
    line-height: 1.5rem;
}

.flash-messages {
    margin-bottom: 1.5rem;
}

.flash-message {
    padding: 0.75rem 1rem;
    padding-right: 2.5rem;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    position: relative;
    display: flex;
    align-items: center;
}

.flash-message-text {
    flex: 1;
}

.flash-message-close {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: currentColor;
    cursor: pointer;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    transition: opacity 0.2s ease-in-out;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
}

.flash-message-close:hover {
    opacity: 1;
}

.flash-message-close:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    opacity: 1;
}

.flash-message-close svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.flash-message.error {
    background: #7f1d1d;
    color: #fca5a5;
    border: 1px solid #991b1b;
}

.flash-message.success {
    background: #14532d;
    color: #86efac;
    border: 1px solid #166534;
}

.flash-message.info {
    background: #1e3a8a;
    color: #93c5fd;
    border: 1px solid #1e40af;
}

.btn {
    padding: 0.625rem 1rem;
    background: #ffffff;
    color: #000000;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: opacity 0.15s ease-in-out;
}

.btn:hover {
    opacity: 0.9;
}

.btn:focus {
    outline: none;
    opacity: 0.9;
}

.btn-secondary {
    background: #1f2937;
    color: #ffffff;
    border: 1px solid #6b7280;
}

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

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #ffffff;
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.form-group input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid #6b7280;
    border-radius: 0.5rem;
    background: #1f2937;
    color: #ffffff;
    font-size: 0.875rem;
    line-height: 1.25rem;
    transition: border-color 0.15s ease-in-out;
}

.form-group input:focus {
    outline: none;
    border-color: #9ca3af;
}

.form-group input::placeholder {
    color: #9ca3af;
}

/* Dashboard Specific Styles */
.user-info-box {
    background: #1f2937;
    border: 2px solid #6b7280;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
}

.user-info-box h3 {
    color: #ffffff;
    margin-bottom: 15px;
    font-size: 20px;
}

.info-row {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #6b7280;
}

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

.info-label {
    font-weight: 600;
    color: #9ca3af;
    width: 180px;
    flex-shrink: 0;
}

.info-value {
    color: #ffffff;
    word-break: break-word;
}

.call-archive-box {
    background: #1f2937;
    border: 2px solid #6b7280;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
}

.call-archive-title {
    color: #ffffff;
    margin-bottom: 20px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.no-access-message {
    text-align: center;
    padding: 40px 20px;
}

.no-access-message p {
    color: #9ca3af;
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
}

.search-icon {
    font-size: 20px;
}

.search-fields {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-fields-row {
    display: flex;
    flex-direction: row;
    gap: 15px;
    align-items: flex-start;
}

.search-fields-row .field-group {
    flex: 1;
}

.search-fields-row .field-group:last-child {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
}

.search-fields-row .field-group:last-child button {
    margin-bottom: 0;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.field-group .error-message {
    min-height: 20px;
    font-size: 12px;
    margin-top: 5px;
    color: #ff6b6b;
    visibility: hidden;
    line-height: 20px;
}

.field-group .error-message.show {
    visibility: visible;
}

.field-group label {
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
}

.field-group input[type="text"],
.field-group input[type="date"],
.field-group input[type="time"],
.field-group select {
    padding: 10px;
    border: 1px solid #6b7280;
    border-radius: 4px;
    background: #1f2937;
    color: #ffffff;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.field-group input[type="text"]::placeholder,
.field-group input[type="date"]::placeholder,
.field-group input[type="time"]::placeholder {
    color: #9ca3af;
}

.field-group input[type="text"]:focus,
.field-group input[type="date"]:focus,
.field-group input[type="time"]:focus,
.field-group select:focus {
    outline: none;
    border-color: #9ca3af;
    background: #1f2937;
}

.field-group select {
    cursor: pointer;
}

.field-group select option {
    padding: 8px;
    background: #1f2937;
    color: #ffffff;
}

.phone-input-wrapper {
    display: flex;
    gap: 10px;
}

.country-code-select {
    padding: 10px;
    border: 1px solid #6b7280;
    border-radius: 4px;
    background: #1f2937;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    width: 150px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.country-code-select option {
    padding: 8px;
    background: #1f2937;
    color: #ffffff;
}

.country-code-select:focus {
    outline: none;
    border-color: #9ca3af;
    background: #1f2937;
}

.limit-select {
    width: 100px;
    flex-shrink: 0;
}

.phone-input-wrapper input[type="text"] {
    flex: 1;
}

.date-time-group {
    display: flex;
    gap: 15px;
}

.date-time-group .field-group {
    flex: 1;
}

.date-input-wrapper {
    position: relative;
}

.form-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.btn-search {
    background: #42a5f5;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-search:hover {
    background: #1e88e5;
}

.btn-export {
    background: #000000;
    color: #ffffff;
    border: 1px solid #6b7280;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-export:hover {
    background: #111827;
}

.export-icon {
    font-size: 16px;
}

.actions-box {
    background: #1f2937;
    border: 2px solid #6b7280;
    border-radius: 8px;
    padding: 25px;
    text-align: right;
}

.actions-box h3 {
    color: #ffffff;
    margin-bottom: 15px;
    font-size: 20px;
}

.actions-box p {
    color: #9ca3af;
    margin-bottom: 20px;
}

.results-box {
    background: #1f2937;
    border: 2px solid #6b7280;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
}

.results-box h3 {
    color: #ffffff;
    margin-bottom: 15px;
    font-size: 20px;
}

.results-count {
    color: #9ca3af;
    margin-bottom: 8px;
    font-weight: 500;
}

.pagination-info {
    color: #9ca3af;
    margin-bottom: 15px;
    font-size: 13px;
    font-weight: 400;
}

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

.results-table table {
    width: 100%;
    border-collapse: collapse;
    background: #000000;
}

.results-table th {
    background: #667eea;
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border: 1px solid #5a6fd8;
}

.results-table td {
    padding: 10px 12px;
    border: 1px solid #6b7280;
    color: #ffffff;
}

.results-table tr:nth-child(even) {
    background: #1f2937;
}

.results-table tr:hover {
    background: #111827;
}

.no-results {
    color: #9ca3af;
    font-style: italic;
    padding: 20px;
    text-align: center;
}

.pagination-controls {
    margin-top: 30px;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    padding-top: 20px;
    border-top: 1px solid #6b7280;
}

.btn-pagination {
    padding: 10px 24px;
    background: #1f2937;
    color: #ffffff;
    border: 1px solid #6b7280;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
}

.btn-pagination:hover {
    background: #374151;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-pagination:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-pagination:focus {
    outline: none;
    border-color: #9ca3af;
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.3);
}

.btn-pagination:disabled {
    background: #1f2937;
    border-color: #4b5563;
    color: #6b7280;
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
    box-shadow: none;
}

.btn-pagination:disabled:hover {
    background: #1f2937;
    border-color: #4b5563;
    transform: none;
    box-shadow: none;
}

.btn-download {
    display: inline-block;
    padding: 6px 12px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-download:hover {
    background: #5568d3;
    color: white;
}

.btn-search:disabled {
    background: #666;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-search:disabled:hover {
    background: #666;
}

/* Login Specific Styles */
body.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-page .container {
    max-width: 550px;
}

.login-card {
    background: #1f2937;
    padding: 2rem;
    border-radius: 0.75rem;
    border: 1px solid #6b7280;
}

.login-page .btn {
    width: 100%;
}

/* Top Banner Styles */
.top-banner {
    background: #000000;
    border-bottom: 1px solid #6b7280;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    margin: -20px -20px 20px -20px;
}

.banner-left {
    display: flex;
    align-items: center;
}

.logo-svg {
    fill: #ffffff;
}

.banner-right {
    display: flex;
    align-items: center;
}

/* User Dropdown Styles */
.user-dropdown {
    position: relative;
}

.user-dropdown-toggle {
    background: transparent;
    border: 1px solid #6b7280;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #ffffff;
    transition: all 0.2s;
}

.user-name {
    font-size: 14px;
    color: #ffffff;
    margin-left: 4px;
}

.user-dropdown-toggle:hover {
    background: #1f2937;
    border-color: #9ca3af;
}

.user-dropdown-toggle:focus {
    outline: none;
    border-color: #9ca3af;
}

.user-icon {
    width: 20px;
    height: 20px;
    stroke: #ffffff;
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #1f2937;
    border: 1px solid #6b7280;
    border-radius: 4px;
    min-width: 320px;
    max-width: 400px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    z-index: 1001;
}

.user-dropdown-menu.show {
    display: flex;
}

.dropdown-item {
    padding: 12px 16px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dropdown-info-item {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
}

.dropdown-item:first-child {
    border-radius: 4px 4px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 4px 4px;
}

.dropdown-link {
    color: #ffffff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    transition: background 0.2s, color 0.2s;
    border-radius: 4px;
    padding: 8px 12px;
    margin: 2px 4px;
}

.dropdown-link:hover {
    background: #4b5563;
    color: #ffffff;
}

.dropdown-icon {
    width: 16px;
    height: 16px;
    stroke: #ffffff;
    flex-shrink: 0;
}

.dropdown-divider {
    height: 1px;
    background: #6b7280;
    margin: 4px 0;
}

.dropdown-label {
    font-size: 12px;
    color: #9ca3af;
    min-width: 120px;
    flex-shrink: 0;
}

.dropdown-value {
    font-size: 14px;
    color: #ffffff;
    word-break: break-word;
    flex: 1;
}

.dropdown-theme-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.dropdown-theme-label {
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 4px;
}

.theme-buttons {
    display: flex;
    gap: 8px;
    width: 100%;
}

.theme-button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: #1f2937;
    border: 1px solid #6b7280;
    border-radius: 4px;
    color: #ffffff;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-button:hover {
    background: #374151;
    border-color: #9ca3af;
}

.theme-button.active {
    background: #ffffff;
    border-color: #ffffff;
    color: #000000;
}

.theme-icon {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    flex-shrink: 0;
}

/* Light Theme Styles */
html.light-theme body {
    background: #ffffff;
    color: #000000;
}

html.light-theme h1 {
    color: #000000;
}

html.light-theme .subtitle {
    color: #4b5563;
}

html.light-theme .top-banner {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

html.light-theme .logo-svg {
    fill: #000000;
}

html.light-theme .user-dropdown-toggle {
    border-color: #d1d5db;
    color: #000000;
}

html.light-theme .user-dropdown-toggle:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

html.light-theme .user-icon {
    stroke: #000000;
}

html.light-theme .user-name {
    color: #000000;
}

html.light-theme .user-dropdown-menu {
    background: #ffffff;
    border-color: #d1d5db;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

html.light-theme .dropdown-item {
    color: #000000;
}

html.light-theme .dropdown-label {
    color: #6b7280;
}

html.light-theme .dropdown-value {
    color: #000000;
}

html.light-theme .dropdown-divider {
    background: #e5e7eb;
}

html.light-theme .dropdown-link {
    color: #000000;
}

html.light-theme .dropdown-link:hover {
    background: #f3f4f6;
    color: #000000;
}

html.light-theme .dropdown-icon {
    stroke: #000000;
}

html.light-theme .theme-button {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #000000;
}

html.light-theme .theme-button:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

html.light-theme .theme-button.active {
    background: #000000;
    border-color: #000000;
    color: #ffffff;
}

html.light-theme .call-archive-box,
html.light-theme .results-box,
html.light-theme .actions-box {
    background: #f9fafb;
    border-color: #e5e7eb;
}

html.light-theme .call-archive-title,
html.light-theme .results-box h3,
html.light-theme .actions-box h3 {
    color: #000000;
}

html.light-theme .field-group label {
    color: #000000;
}

html.light-theme .field-group input[type="text"],
html.light-theme .field-group input[type="date"],
html.light-theme .field-group input[type="time"],
html.light-theme .field-group select,
html.light-theme .country-code-select {
    background: #ffffff;
    border-color: #d1d5db;
    color: #000000;
}

html.light-theme .field-group input[type="text"]:focus,
html.light-theme .field-group input[type="date"]:focus,
html.light-theme .field-group input[type="time"]:focus,
html.light-theme .field-group select:focus,
html.light-theme .country-code-select:focus {
    border-color: #9ca3af;
    background: #ffffff;
}

html.light-theme .field-group input[type="text"]::placeholder,
html.light-theme .field-group input[type="date"]::placeholder,
html.light-theme .field-group input[type="time"]::placeholder {
    color: #9ca3af;
}

html.light-theme .country-code-select option,
html.light-theme .field-group select option {
    background: #ffffff;
    color: #000000;
}

html.light-theme .pagination-info {
    color: #6b7280;
}

html.light-theme .results-table table {
    background: #ffffff;
}

html.light-theme .results-table th {
    background: #667eea;
    color: white;
}

html.light-theme .results-table td {
    border-color: #e5e7eb;
    color: #000000;
}

html.light-theme .results-table tr:nth-child(even) {
    background: #f9fafb;
}

html.light-theme .results-table tr:hover {
    background: #f3f4f6;
}

html.light-theme .results-count,
html.light-theme .no-results {
    color: #6b7280;
}

html.light-theme .no-access-message p {
    color: #6b7280;
}

html.light-theme .pagination-controls {
    border-top-color: #e5e7eb;
}

html.light-theme .btn-pagination {
    background: #ffffff;
    color: #000000;
    border-color: #d1d5db;
}

html.light-theme .btn-pagination:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #000000;
}

html.light-theme .btn-pagination:focus {
    border-color: #9ca3af;
    box-shadow: 0 0 0 3px rgba(156, 163, 175, 0.3);
}

html.light-theme .btn-pagination:disabled {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: #9ca3af;
}

html.light-theme .btn-pagination:disabled:hover {
    background: #f9fafb;
    border-color: #e5e7eb;
}

html.light-theme .flash-message-close {
    background: transparent;
}
