/*
 * SII Invoice Viewer - Styles
 */

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Welcome/Sideload message */
.ms-welcome__main {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1 0 0;
    padding: 10px 20px;
}

.ms-welcome__main > h2 {
    width: 100%;
    text-align: center;
}

/* App body */
#app-body {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Views */
.view {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* App header */
.app-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e1e1e1;
}

.app-header h1 {
    margin: 0 0 4px 0;
    color: #323130;
}

.app-header p {
    margin: 0;
    color: #605e5c;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

/* Form styles */
.form-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-weight: 600;
    color: #323130;
}

.ms-TextField-field {
    padding: 8px 12px;
    border: 1px solid #8a8886;
    border-radius: 2px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.1s ease;
}

.ms-TextField-field:focus {
    border-color: #0078d4;
}

.ms-TextField-field::placeholder {
    color: #a19f9d;
}

/* Buttons */
.ms-Button {
    padding: 8px 16px;
    border: none;
    border-radius: 2px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.1s ease;
}

.ms-Button--primary {
    background-color: #0078d4;
    color: white;
}

.ms-Button--primary:hover {
    background-color: #106ebe;
}

.ms-Button--primary:active {
    background-color: #005a9e;
}

.ms-Button--default {
    background-color: #f3f2f1;
    color: #323130;
    border: 1px solid #8a8886;
}

.ms-Button--default:hover {
    background-color: #e1dfdd;
}

.ms-Button--small {
    padding: 4px 12px;
    font-size: 12px;
}

.ms-Button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Error and success messages */
.error-text {
    color: #a4262c;
}

.error-message {
    color: #a4262c;
    padding: 8px;
    background-color: #fde7e9;
    border-radius: 2px;
    margin-top: 8px;
}

.error-message:empty {
    display: none;
}

.success-message {
    color: #107c10;
    padding: 8px;
    background-color: #dff6dd;
    border-radius: 2px;
    margin-top: 8px;
}

.loading-message {
    color: #0078d4;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.loading-message .ms-Icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Empresa selector */
.empresa-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background-color: #e8f4fd;
    border-radius: 4px;
    border-left: 3px solid #0078d4;
}

.empresa-selector label {
    font-weight: 600;
    white-space: nowrap;
}

.empresa-selector select {
    flex: 1;
    min-width: 150px;
}

/* Period selector */
.period-selector {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px;
    background-color: #f3f2f1;
    border-radius: 4px;
}

.period-selector label {
    font-weight: 600;
}

.ms-Dropdown-select {
    padding: 6px 10px;
    border: 1px solid #8a8886;
    border-radius: 2px;
    font-size: 14px;
    background-color: white;
    min-width: 120px;
}

.operation-toggle {
    display: flex;
    gap: 12px;
    margin-left: 8px;
}

.operation-toggle label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: normal;
    cursor: pointer;
}

/* Data tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 16px;
}

.data-table th,
.data-table td {
    padding: 8px 6px;
    text-align: left;
    border-bottom: 1px solid #e1e1e1;
}

.data-table th {
    background-color: #f3f2f1;
    font-weight: 600;
    color: #323130;
    position: sticky;
    top: 0;
}

.data-table tbody tr:hover {
    background-color: #f3f2f1;
}

.data-table tbody tr.clickable {
    cursor: pointer;
}

.data-table tbody tr.clickable:hover {
    background-color: #edebe9;
}

.data-table--small {
    font-size: 11px;
}

.data-table--small th,
.data-table--small td {
    padding: 6px 4px;
}

/* Numeric columns */
.data-table .num {
    text-align: right;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e1e1e1;
}

/* Responsive table container */
#resumen-container,
#details-container {
    flex: 1;
    overflow-y: auto;
    min-height: 100px;
}

/* User info */
#user-info {
    color: #605e5c;
    font-size: 12px;
}

/* Remember me checkbox */
.remember-me {
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
}

.remember-me label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: normal !important;
    cursor: pointer;
}

.remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.remember-me-hint {
    color: #605e5c;
}

/* PDF Button */
.pdf-btn {
    padding: 4px 8px;
    font-size: 11px;
    background-color: #d13438;
    color: white;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background-color 0.1s ease;
}

.pdf-btn:hover {
    background-color: #a4262c;
}

.pdf-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pdf-btn .ms-Icon {
    font-size: 12px;
}
