/**
 * QUARQ Tank Registry - Frontend Styles
 */

/* Container */
.qtr-form-container,
.qtr-listing-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Headings */
.qtr-form-container h2,
.qtr-listing-container h2 {
    margin: 0 0 20px 0;
    color: #1e3a5f;
    font-size: 28px;
    font-weight: 600;
}

.qtr-form-container h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 2px solid #0066cc;
}

/* Form Sections */
.qtr-form-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

/* Form Rows and Fields */
.qtr-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.qtr-form-row:last-child {
    margin-bottom: 0;
}

.qtr-form-field {
    flex: 1;
}

.qtr-form-field.qtr-full-width {
    flex: 0 0 100%;
}

.qtr-form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.qtr-form-field label .required {
    color: #dc3545;
}

.qtr-form-field input,
.qtr-form-field textarea,
.qtr-form-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    background-color: #fff;
}

.qtr-form-field select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.qtr-form-field input:focus,
.qtr-form-field textarea:focus,
.qtr-form-field select:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.qtr-form-field input:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

.qtr-form-field input.qtr-input-error {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.qtr-form-field input.qtr-input-error:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.qtr-date-input {
    font-family: monospace;
}

.qtr-field-note {
    margin: 5px 0 0 0;
    font-size: 13px;
    color: #666;
}

/* OTP Input */
.qtr-otp-input {
    text-align: center;
    font-size: 24px !important;
    letter-spacing: 8px;
    font-weight: bold;
    max-width: 200px;
}

/* Buttons */
.qtr-form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.qtr-button {
    display: inline-block;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.qtr-button:hover {
    transform: translateY(-1px);
}

.qtr-button:active {
    transform: translateY(0);
}

.qtr-button-primary {
    background-color: #0066cc;
    color: #fff;
}

.qtr-button-primary:hover {
    background-color: #0052a3;
}

.qtr-button-secondary {
    background-color: #6c757d;
    color: #fff;
}

.qtr-button-secondary:hover {
    background-color: #5a6268;
}

.qtr-button-danger {
    background-color: #dc3545;
    color: #fff;
}

.qtr-button-danger:hover {
    background-color: #c82333;
}

.qtr-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Messages */
.qtr-form-messages {
    margin-top: 20px;
}

.qtr-message {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.qtr-message-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.qtr-message-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.qtr-message-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Error message for invalid token */
.qtr-error-message {
    padding: 30px;
    background: #f8f8f8;
    border-radius: 8px;
    text-align: center;
}

.qtr-error-message h2 {
    color: #dc3545;
}

/* Success message */
.qtr-success-message {
    padding: 30px;
    background: #d4edda;
    border-radius: 8px;
    text-align: center;
}

.qtr-success-message h3 {
    color: #155724;
    border: none;
    margin-bottom: 10px;
}

/* Ownership transfer notice */
.qtr-ownership-notice {
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    margin-bottom: 20px;
}

.qtr-ownership-notice p {
    margin: 0;
    color: #856404;
}

/* Recovery form steps */
.qtr-recovery-step {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.qtr-step-info {
    padding: 15px;
    background: #d1ecf1;
    border-radius: 4px;
    color: #0c5460;
    margin-bottom: 20px;
}

/* Tank Listing */
.qtr-listing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.qtr-listing-header h2 {
    margin: 0;
}

.qtr-search-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.qtr-search-form input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 250px;
}

.qtr-search-form input:focus {
    outline: none;
    border-color: #0066cc;
}

.qtr-clear-search {
    color: #dc3545;
    text-decoration: none;
    font-size: 14px;
}

.qtr-clear-search:hover {
    text-decoration: underline;
}

.qtr-search-results-info {
    color: #666;
    font-style: italic;
    margin-bottom: 15px;
}

/* Tanks Table */
.qtr-tanks-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.qtr-tanks-table th,
.qtr-tanks-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.qtr-tanks-table th {
    background: #1e3a5f;
    color: #fff;
    font-weight: 600;
}

.qtr-tanks-table tbody tr:hover {
    background: #f5f5f5;
}

.qtr-tanks-table .qtr-tank-id {
    font-weight: bold;
    color: #0066cc;
}

.qtr-no-results {
    padding: 30px;
    text-align: center;
    color: #666;
    background: #f8f8f8;
    border-radius: 4px;
}

/* Tank Status Badges */
.qtr-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.qtr-status-valid {
    background-color: #d4edda;
    color: #155724;
}

.qtr-status-overdue {
    background-color: #f8d7da;
    color: #721c24;
}

.qtr-status-unknown {
    background-color: #e9ecef;
    color: #6c757d;
}

/* Pagination */
.qtr-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 20px 0;
}

.qtr-page-link {
    padding: 8px 16px;
    background: #0066cc;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.qtr-page-link:hover {
    background: #0052a3;
    color: #fff;
}

.qtr-page-info {
    color: #666;
}

.qtr-listing-footer {
    text-align: center;
    color: #666;
    font-size: 14px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Form intro */
.qtr-form-intro {
    color: #666;
    margin-bottom: 20px;
}

/* Loading state */
.qtr-loading {
    position: relative;
    pointer-events: none;
}

.qtr-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.qtr-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0066cc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal */
.qtr-modal {
    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: 9999;
}

.qtr-modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.qtr-modal-content h3 {
    margin: 0 0 15px 0;
    color: #333;
    border: none;
    padding: 0;
}

.qtr-modal-content p {
    margin: 0 0 15px 0;
    color: #666;
}

.qtr-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Tank ID field styling */
.qtr-tank-id-field {
    font-weight: bold;
    font-size: 18px !important;
    letter-spacing: 2px;
    text-align: center;
    max-width: 150px;
}

/* Responsive */
@media (max-width: 768px) {
    .qtr-form-row {
        flex-direction: column;
        gap: 15px;
    }

    .qtr-listing-header {
        flex-direction: column;
        align-items: stretch;
    }

    .qtr-search-form {
        flex-direction: column;
    }

    .qtr-search-form input {
        min-width: 100%;
    }

    .qtr-tanks-table {
        font-size: 14px;
    }

    .qtr-tanks-table th,
    .qtr-tanks-table td {
        padding: 10px;
    }

    .qtr-pagination {
        flex-direction: column;
        gap: 10px;
    }
}
